From 06347a64cac5e33574713a59ace9d1d0ea4b6f82 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 25 May 2024 05:19:46 +0800 Subject: vim-patch:9.1.0443: Can't use blockwise selection with width for getregion() (#28985) Problem: Can't use a blockwise selection with a width for getregion(). Solution: Add support for blockwise selection with width like the return value of getregtype() or the "regtype" value of TextYankPost (zeertzjq). closes: vim/vim#14842 https://github.com/vim/vim/commit/afc2295c2201ae87bfbb42d5f5315ad0583ccabf --- test/old/testdir/test_visual.vim | 81 ++++++++++++++++++++++++++++++---------- 1 file changed, 62 insertions(+), 19 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_visual.vim b/test/old/testdir/test_visual.vim index b7b5f611c4..f414f502f7 100644 --- a/test/old/testdir/test_visual.vim +++ b/test/old/testdir/test_visual.vim @@ -1968,6 +1968,14 @@ func Test_visual_getregion() #" using invalid value for "type" call assert_fails("call getregion(getpos('.'), getpos('.'), {'type': '' })", 'E475:') call assert_fails("call getregionpos(getpos('.'), getpos('.'), {'type': '' })", 'E475:') + call assert_fails("call getregion(getpos('.'), getpos('.'), {'type': 'v0' })", 'E475:') + call assert_fails("call getregionpos(getpos('.'), getpos('.'), {'type': 'v0' })", 'E475:') + call assert_fails("call getregion(getpos('.'), getpos('.'), {'type': 'V0' })", 'E475:') + call assert_fails("call getregionpos(getpos('.'), getpos('.'), {'type': 'V0' })", 'E475:') + call assert_fails("call getregion(getpos('.'), getpos('.'), {'type': '\0' })", 'E475:') + call assert_fails("call getregionpos(getpos('.'), getpos('.'), {'type': '\0' })", 'E475:') + call assert_fails("call getregion(getpos('.'), getpos('.'), {'type': '\1:' })", 'E475:') + call assert_fails("call getregionpos(getpos('.'), getpos('.'), {'type': '\1:' })", 'E475:') #" using a mark from another buffer to current buffer new @@ -2546,30 +2554,65 @@ func Test_getregion_invalid_buf() bwipe! endfunc -func Test_getregion_maxcol() - new +func Test_getregion_after_yank() + func! Check_Results(type) + call assert_equal(g:expected_region, + \ getregion(getpos("'["), getpos("']"), #{ type: a:type })) + call assert_equal(g:expected_regionpos, + \ getregionpos(getpos("'["), getpos("']"), #{ type: a:type })) + call assert_equal(g:expected_region, + \ getregion(getpos("']"), getpos("'["), #{ type: a:type })) + call assert_equal(g:expected_regionpos, + \ getregionpos(getpos("']"), getpos("'["), #{ type: a:type })) + let g:checked = 1 + endfunc + autocmd TextYankPost * \ : if v:event.operator ==? 'y' - \ | call assert_equal([ - \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 4, 0]], - \ ], - \ getregionpos(getpos("'["), getpos("']"), - \ #{ mode: visualmode() })) - \ | call assert_equal(['abcd'], - \ getregion(getpos("'["), getpos("']"), - \ #{ mode: visualmode() })) - \ | call assert_equal([ - \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 4, 0]], - \ ], - \ getregionpos(getpos("']"), getpos("'["), - \ #{ mode: visualmode() })) - \ | call assert_equal(['abcd'], - \ getregion(getpos("']"), getpos("'["), - \ #{ mode: visualmode() })) + \ | call Check_Results(v:event.regtype) \ | endif - call setline(1, ['abcd', 'efghij']) + + new + call setline(1, ['abcd', 'efghijk', 'lmn']) + + let g:expected_region = ['abcd'] + let g:expected_regionpos = [ + \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 4, 0]], + \ ] + let g:checked = 0 normal yy + call assert_equal(1, g:checked) + call Check_Results(getregtype('"')) + + let g:expected_region = ['cd', 'ghijk', 'n'] + let g:expected_regionpos = [ + \ [[bufnr('%'), 1, 3, 0], [bufnr('%'), 1, 4, 0]], + \ [[bufnr('%'), 2, 3, 0], [bufnr('%'), 2, 7, 0]], + \ [[bufnr('%'), 3, 3, 0], [bufnr('%'), 3, 3, 0]], + \ ] + let g:checked = 0 + call feedkeys("gg0ll\jj$y", 'tx') + call assert_equal(1, g:checked) + call Check_Results(getregtype('"')) + + let g:expected_region = ['bc', 'fg', 'mn'] + let g:expected_regionpos = [ + \ [[bufnr('%'), 1, 2, 0], [bufnr('%'), 1, 3, 0]], + \ [[bufnr('%'), 2, 2, 0], [bufnr('%'), 2, 3, 0]], + \ [[bufnr('%'), 3, 2, 0], [bufnr('%'), 3, 3, 0]], + \ ] + let g:checked = 0 + call feedkeys("gg0l\jjly", 'tx') + call assert_equal(1, g:checked) + call Check_Results(getregtype('"')) + bwipe! + + unlet g:expected_region + unlet g:expected_regionpos + unlet g:checked + autocmd! TextYankPost + delfunc Check_Results endfunc func Test_visual_block_cursor_delete() -- cgit From 4757d497f3c85cc343f7dcbc09f95e43ba5c1314 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 25 May 2024 16:53:10 +0800 Subject: vim-patch:9.1.0444: Not enough tests for getregion() with multibyte chars (#29000) Problem: Not enough tests for getregion() with multibyte chars. Solution: Add a few more tests (zeertzjq). closes: vim/vim#14844 https://github.com/vim/vim/commit/dff55a335889c746a79974f7c52cdcdebad682c2 --- test/old/testdir/test_visual.vim | 62 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_visual.vim b/test/old/testdir/test_visual.vim index f414f502f7..3c510ffd0b 100644 --- a/test/old/testdir/test_visual.vim +++ b/test/old/testdir/test_visual.vim @@ -2594,6 +2594,7 @@ func Test_getregion_after_yank() call feedkeys("gg0ll\jj$y", 'tx') call assert_equal(1, g:checked) call Check_Results(getregtype('"')) + call assert_equal(g:expected_region, getreg('"', v:true, v:true)) let g:expected_region = ['bc', 'fg', 'mn'] let g:expected_regionpos = [ @@ -2605,6 +2606,67 @@ func Test_getregion_after_yank() call feedkeys("gg0l\jjly", 'tx') call assert_equal(1, g:checked) call Check_Results(getregtype('"')) + call assert_equal(g:expected_region, getreg('"', v:true, v:true)) + + bwipe! + + new + let lines = ['asdfghjkl', '«口=口»', 'qwertyuiop', '口口=口口', 'zxcvbnm'] + call setline(1, lines) + + let g:expected_region = lines + let g:expected_regionpos = [ + \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 9, 0]], + \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 11, 0]], + \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 10, 0]], + \ [[bufnr('%'), 4, 1, 0], [bufnr('%'), 4, 13, 0]], + \ [[bufnr('%'), 5, 1, 0], [bufnr('%'), 5, 7, 0]], + \ ] + let g:checked = 0 + call feedkeys('ggyG', 'tx') + call assert_equal(1, g:checked) + call Check_Results(getregtype('"')) + call assert_equal(g:expected_region, getreg('"', v:true, v:true)) + + let g:expected_region = ['=口»', 'qwertyuiop', '口口=口'] + let g:expected_regionpos = [ + \ [[bufnr('%'), 2, 6, 0], [bufnr('%'), 2, 11, 0]], + \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 10, 0]], + \ [[bufnr('%'), 4, 1, 0], [bufnr('%'), 4, 10, 0]], + \ ] + let g:checked = 0 + call feedkeys('2gg02lv2j2ly', 'tx') + call assert_equal(1, g:checked) + call Check_Results(getregtype('"')) + call assert_equal(g:expected_region, getreg('"', v:true, v:true)) + + let g:expected_region = ['asdf', '«口=', 'qwer', '口口', 'zxcv'] + let g:expected_regionpos = [ + \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 4, 0]], + \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 6, 0]], + \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 4, 0]], + \ [[bufnr('%'), 4, 1, 0], [bufnr('%'), 4, 6, 0]], + \ [[bufnr('%'), 5, 1, 0], [bufnr('%'), 5, 4, 0]], + \ ] + let g:checked = 0 + call feedkeys("G0\3l4ky", 'tx') + call assert_equal(1, g:checked) + call Check_Results(getregtype('"')) + call assert_equal(g:expected_region, getreg('"', v:true, v:true)) + + let g:expected_region = ['ghjkl', '口»', 'tyuiop', '=口口', 'bnm'] + let g:expected_regionpos = [ + \ [[bufnr('%'), 1, 5, 0], [bufnr('%'), 1, 9, 0]], + \ [[bufnr('%'), 2, 7, 0], [bufnr('%'), 2, 11, 0]], + \ [[bufnr('%'), 3, 5, 0], [bufnr('%'), 3, 10, 0]], + \ [[bufnr('%'), 4, 7, 0], [bufnr('%'), 4, 13, 0]], + \ [[bufnr('%'), 5, 5, 0], [bufnr('%'), 5, 7, 0]], + \ ] + let g:checked = 0 + call feedkeys("G04l\$4ky", 'tx') + call assert_equal(1, g:checked) + call Check_Results(getregtype('"')) + call assert_equal(g:expected_region, getreg('"', v:true, v:true)) bwipe! -- cgit From 3d39ea3ea9b6e66640e59731d155d731218e7e62 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 26 May 2024 07:11:50 +0800 Subject: vim-patch:9.1.0442: hare runtime files outdated (#29011) Problem: hare runtime files outdated Solution: runtime(hare): update hare.vim to match upstream (Amelia Clarke) closes: vim/vim#14836 https://github.com/vim/vim/commit/35dfe58a540e2fb0eff953630f8e4fcbf4bc26ca Co-authored-by: Amelia Clarke --- test/old/testdir/test_filetype.vim | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 34fe93fd55..16125559cf 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -1511,6 +1511,41 @@ func Test_git_file() filetype off endfunc +func Test_haredoc_file() + filetype on + call assert_true(mkdir('foo/bar', 'pR')) + + call writefile([], 'README', 'D') + split README + call assert_notequal('haredoc', &filetype) + bwipe! + + let g:filetype_haredoc = 1 + split README + call assert_notequal('haredoc', &filetype) + bwipe! + + call writefile([], 'foo/quux.ha') + split README + call assert_equal('haredoc', &filetype) + bwipe! + call delete('foo/quux.ha') + + call writefile([], 'foo/bar/baz.ha', 'D') + split README + call assert_notequal('haredoc', &filetype) + bwipe! + + let g:haredoc_search_depth = 2 + split README + call assert_equal('haredoc', &filetype) + bwipe! + unlet g:filetype_haredoc + unlet g:haredoc_search_depth + + filetype off +endfunc + func Test_hook_file() filetype on -- cgit From 22fe04452e12944b409c8ee92cf4069ac8026987 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 27 May 2024 05:50:49 +0800 Subject: vim-patch:9.1.0446: getregionpos() inconsistent for partly-selected multibyte char (#29032) Problem: getregionpos() behaves inconsistently for a partly-selected multibyte char. Solution: Always use column of the first byte for a partly-selected multibyte char (zeertzjq). closes: vim/vim#14851 https://github.com/vim/vim/commit/ef73374dc3e4bf8104ba31d5b22517f8028b467a --- test/old/testdir/test_visual.vim | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_visual.vim b/test/old/testdir/test_visual.vim index 3c510ffd0b..0b840944bf 100644 --- a/test/old/testdir/test_visual.vim +++ b/test/old/testdir/test_visual.vim @@ -2077,10 +2077,12 @@ func Test_visual_getregion() \ getregion(getpos('v'), getpos('.'), {'type': "\" })) call assert_equal([ \ [[bufnr('%'), 1, 5, 0], [bufnr('%'), 1, 5, 0]], - \ [[bufnr('%'), 2, 10, 1], [bufnr('%'), 2, 10, 2]], + \ [[bufnr('%'), 2, 7, 1], [bufnr('%'), 2, 7, 2]], \ [[bufnr('%'), 3, 5, 0], [bufnr('%'), 3, 5, 0]], \ ], \ getregionpos(getpos('v'), getpos('.'), {'type': "\" })) + call assert_equal(['efghijk«', '🇦«🇧«🇨«🇩', '12345'], + \ getregion(getpos('v'), getpos('.'), {'type': 'v' })) call assert_equal([ \ [[bufnr('%'), 1, 5, 0], [bufnr('%'), 1, 13, 0]], \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 22, 0]], @@ -2088,6 +2090,28 @@ func Test_visual_getregion() \ ], \ getregionpos(getpos('v'), getpos('.'), {'type': 'v' })) + call cursor(1, 5) + call feedkeys("\\5l2j", 'xt') + call assert_equal(['efghij', ' «🇨« ', '567890'], + \ getregion(getpos('v'), getpos('.'), {'type': "\" })) + call assert_equal([ + \ [[bufnr('%'), 1, 5, 0], [bufnr('%'), 1, 10, 0]], + \ [[bufnr('%'), 2, 7, 1], [bufnr('%'), 2, 19, 1]], + \ [[bufnr('%'), 3, 5, 0], [bufnr('%'), 3, 10, 0]], + \ ], + \ getregionpos(getpos('v'), getpos('.'), {'type': "\" })) + + call cursor(1, 4) + call feedkeys("\\02j", 'xt') + call assert_equal(['abcd', '🇦« ', '1234'], + \ getregion(getpos('v'), getpos('.'), {'type': "\" })) + call assert_equal([ + \ [[bufnr('%'), 1, 1, 0], [bufnr('%'), 1, 4, 0]], + \ [[bufnr('%'), 2, 1, 0], [bufnr('%'), 2, 7, 1]], + \ [[bufnr('%'), 3, 1, 0], [bufnr('%'), 3, 4, 0]], + \ ], + \ getregionpos(getpos('v'), getpos('.'), {'type': "\" })) + #" characterwise selection with multibyte chars call cursor(1, 1) call feedkeys("\vj", 'xt') -- cgit From dbc2678f46970703616765dadff1234fdcce27b7 Mon Sep 17 00:00:00 2001 From: glepnir Date: Mon, 27 May 2024 22:02:24 +0800 Subject: vim-patch:9.1.0447: completion may be wrong when deleting all chars (#29040) Problem: completion may be wrong when deleting all chars. Solution: reset compl_shown_match (glepnir). closes: https://github.com/vim/vim/pull/14854 https://github.com/vim/vim/commit/53387c55a13bc1013a6ab721d4bd0bd04c6935c4 --- test/old/testdir/test_ins_complete.vim | 16 ++++++++-------- test/old/testdir/test_popup.vim | 2 ++ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 3f67a06999..45db2a7364 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -700,14 +700,14 @@ func Test_pum_with_preview_win() CheckScreendump let lines =<< trim END - funct Omni_test(findstart, base) - if a:findstart - return col(".") - 1 - endif - return [#{word: "one", info: "1info"}, #{word: "two", info: "2info"}, #{word: "three", info: "3info"}] - endfunc - set omnifunc=Omni_test - set completeopt+=longest + funct Omni_test(findstart, base) + if a:findstart + return col(".") - 1 + endif + return [#{word: "one", info: "1info"}, #{word: "two", info: "2info"}, #{word: "three", info: "3info"}] + endfunc + set omnifunc=Omni_test + set completeopt+=longest END call writefile(lines, 'Xpreviewscript') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 56c881b958..5ae2ed5ed5 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1178,6 +1178,8 @@ func Test_CompleteChanged() set completeopt=menu,menuone call feedkeys("i\\\\\f", 'tx') call assert_equal('five', g:word) + call feedkeys("i\\\\\f\", 'tx') + call assert_equal('one', g:word) autocmd! AAAAA_Group set complete& completeopt& -- cgit From 40679c764a675d8039d0ae5c72cbde5f0dbe6db5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 30 May 2024 14:39:48 +0800 Subject: vim-patch:8.2.3061: testing the shell option is incomplete and spread out (#29090) Problem: Testing the shell option is incomplete and spread out. Solution: Move shell tests to one file and increase coverage. (Yegappan Lakshmanan, closes vim/vim#8464) https://github.com/vim/vim/commit/054794c20f6322bbd9482c4124041dc0a140c78e Co-authored-by: Yegappan Lakshmanan --- test/old/testdir/test_functions.vim | 48 ------------------------------------- test/old/testdir/test_options.vim | 29 ---------------------- test/old/testdir/test_shell.vim | 23 ++++++++++++++++++ 3 files changed, 23 insertions(+), 77 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 18d0d9aa5d..fa9ae63381 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -2143,54 +2143,6 @@ func Test_balloon_show() endif endfunc -func Test_shellescape() - let save_shell = &shell - set shell=bash - call assert_equal("'text'", shellescape('text')) - call assert_equal("'te\"xt'", 'te"xt'->shellescape()) - call assert_equal("'te'\\''xt'", shellescape("te'xt")) - - call assert_equal("'te%xt'", shellescape("te%xt")) - call assert_equal("'te\\%xt'", shellescape("te%xt", 1)) - call assert_equal("'te#xt'", shellescape("te#xt")) - call assert_equal("'te\\#xt'", shellescape("te#xt", 1)) - call assert_equal("'te!xt'", shellescape("te!xt")) - call assert_equal("'te\\!xt'", shellescape("te!xt", 1)) - - call assert_equal("'te\nxt'", shellescape("te\nxt")) - call assert_equal("'te\\\nxt'", shellescape("te\nxt", 1)) - set shell=tcsh - call assert_equal("'te\\!xt'", shellescape("te!xt")) - call assert_equal("'te\\\\!xt'", shellescape("te!xt", 1)) - call assert_equal("'te\\\nxt'", shellescape("te\nxt")) - call assert_equal("'te\\\\\nxt'", shellescape("te\nxt", 1)) - - set shell=fish - call assert_equal("'text'", shellescape('text')) - call assert_equal("'te\"xt'", shellescape('te"xt')) - call assert_equal("'te'\\''xt'", shellescape("te'xt")) - - call assert_equal("'te%xt'", shellescape("te%xt")) - call assert_equal("'te\\%xt'", shellescape("te%xt", 1)) - call assert_equal("'te#xt'", shellescape("te#xt")) - call assert_equal("'te\\#xt'", shellescape("te#xt", 1)) - call assert_equal("'te!xt'", shellescape("te!xt")) - call assert_equal("'te\\!xt'", shellescape("te!xt", 1)) - - call assert_equal("'te\\\\xt'", shellescape("te\\xt")) - call assert_equal("'te\\\\xt'", shellescape("te\\xt", 1)) - call assert_equal("'te\\\\'\\''xt'", shellescape("te\\'xt")) - call assert_equal("'te\\\\'\\''xt'", shellescape("te\\'xt", 1)) - call assert_equal("'te\\\\!xt'", shellescape("te\\!xt")) - call assert_equal("'te\\\\\\!xt'", shellescape("te\\!xt", 1)) - call assert_equal("'te\\\\%xt'", shellescape("te\\%xt")) - call assert_equal("'te\\\\\\%xt'", shellescape("te\\%xt", 1)) - call assert_equal("'te\\\\#xt'", shellescape("te\\#xt")) - call assert_equal("'te\\\\\\#xt'", shellescape("te\\#xt", 1)) - - let &shell = save_shell -endfunc - func Test_setbufvar_options() " This tests that aucmd_prepbuf() and aucmd_restbuf() properly restore the " window layout and cursor position. diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index 7786f82af2..8ffd8f7ef8 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -1400,35 +1400,6 @@ func Test_buftype() bwipe! endfunc -" Test for the 'shell' option -func Test_shell() - throw 'Skipped: Nvim does not have :shell' - CheckUnix - let save_shell = &shell - set shell= - let caught_e91 = 0 - try - shell - catch /E91:/ - let caught_e91 = 1 - endtry - call assert_equal(1, caught_e91) - let &shell = save_shell -endfunc - -" Test for the 'shellquote' option -func Test_shellquote() - CheckUnix - set shellquote=# - set verbose=20 - redir => v - silent! !echo Hello - redir END - set verbose& - set shellquote& - call assert_match(': "#echo Hello#"', v) -endfunc - " Test for the 'rightleftcmd' option func Test_rightleftcmd() CheckFeature rightleft diff --git a/test/old/testdir/test_shell.vim b/test/old/testdir/test_shell.vim index c50161a8ed..baaa327965 100644 --- a/test/old/testdir/test_shell.vim +++ b/test/old/testdir/test_shell.vim @@ -128,6 +128,29 @@ func Test_shellescape() call assert_equal("'te\\\nxt'", shellescape("te\nxt")) call assert_equal("'te\\\\\nxt'", shellescape("te\nxt", 1)) + set shell=fish + call assert_equal("'text'", shellescape('text')) + call assert_equal("'te\"xt'", shellescape('te"xt')) + call assert_equal("'te'\\''xt'", shellescape("te'xt")) + + call assert_equal("'te%xt'", shellescape("te%xt")) + call assert_equal("'te\\%xt'", shellescape("te%xt", 1)) + call assert_equal("'te#xt'", shellescape("te#xt")) + call assert_equal("'te\\#xt'", shellescape("te#xt", 1)) + call assert_equal("'te!xt'", shellescape("te!xt")) + call assert_equal("'te\\!xt'", shellescape("te!xt", 1)) + + call assert_equal("'te\\\\xt'", shellescape("te\\xt")) + call assert_equal("'te\\\\xt'", shellescape("te\\xt", 1)) + call assert_equal("'te\\\\'\\''xt'", shellescape("te\\'xt")) + call assert_equal("'te\\\\'\\''xt'", shellescape("te\\'xt", 1)) + call assert_equal("'te\\\\!xt'", shellescape("te\\!xt")) + call assert_equal("'te\\\\\\!xt'", shellescape("te\\!xt", 1)) + call assert_equal("'te\\\\%xt'", shellescape("te\\%xt")) + call assert_equal("'te\\\\\\%xt'", shellescape("te\\%xt", 1)) + call assert_equal("'te\\\\#xt'", shellescape("te\\#xt")) + call assert_equal("'te\\\\\\#xt'", shellescape("te\\#xt", 1)) + let &shell = save_shell endfunc -- cgit From 2de12e9bd7fe72eb4656a3c0f689caf6ce971451 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 31 May 2024 05:50:57 +0800 Subject: vim-patch:9.1.0451: No test for escaping '<' with shellescape() Problem: No test for escaping '<' with shellescape() Solution: Add a test. Use memcpy() in code to make it easier to understand. Fix a typo (zeertzjq). closes: vim/vim#14876 https://github.com/vim/vim/commit/88c8c547d5fc380e5685c2b01ec564ccdf9b259a --- test/old/testdir/test_shell.vim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_shell.vim b/test/old/testdir/test_shell.vim index baaa327965..c2320d8f39 100644 --- a/test/old/testdir/test_shell.vim +++ b/test/old/testdir/test_shell.vim @@ -119,6 +119,10 @@ func Test_shellescape() call assert_equal("'te\\#xt'", shellescape("te#xt", 1)) call assert_equal("'te!xt'", shellescape("te!xt")) call assert_equal("'te\\!xt'", shellescape("te!xt", 1)) + call assert_equal("'text'", shellescape("text")) + call assert_equal("'te\\xt'", shellescape("text", 1)) + call assert_equal("'te%xt'", shellescape("te%xt")) + call assert_equal("'te\\\\%xt'", shellescape("te%xt", 1)) call assert_equal("'te\nxt'", shellescape("te\nxt")) call assert_equal("'te\\\nxt'", shellescape("te\nxt", 1)) -- cgit From 07af492f635c51d44d02d8012611cc5e11a4af19 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 31 May 2024 12:07:31 +0200 Subject: vim-patch:9.1.0453: filetype: rasi files are not recognized Problem: filetype: rasi files are not recognized Solution: regonize '*.rasi' files as rasi filetype, include a filetype and syntax plugin (Pierrick Guillaume) ported from: https://github.com/Fymyte/rasi.vim closes: vim/vim#14821 https://github.com/vim/vim/commit/280e5b13ca568ed592a894140bf1ac74356f4b33 Co-authored-by: Pierrick Guillaume --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 16125559cf..c8fd48e064 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -181,6 +181,7 @@ func s:GetFilenameChecks() abort \ 'csdl': ['file.csdl'], \ 'csp': ['file.csp', 'file.fdr'], \ 'css': ['file.css'], + \ 'rasi': ['file.rasi'], \ 'cterm': ['file.con'], \ 'csv': ['file.csv'], \ 'cucumber': ['file.feature'], -- cgit From 9b3dfa3ac0dbc823c00a23ed7bd57dc0f0782a3f Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 31 May 2024 12:33:00 +0200 Subject: vim-patch:9.1.0454: minor issues in test_filetype with rasi test Problem: minor issues in test_filetype with rasi test (after 9.1.0453) Solution: re-sort test_filetype, fix wrong syntax.txt help tags https://github.com/vim/vim/commit/f3dd6f617c65a9b939697362efe6833eb2778612 Co-authored-by: Christian Brabandt --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index c8fd48e064..88cd8fc416 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -181,7 +181,6 @@ func s:GetFilenameChecks() abort \ 'csdl': ['file.csdl'], \ 'csp': ['file.csp', 'file.fdr'], \ 'css': ['file.css'], - \ 'rasi': ['file.rasi'], \ 'cterm': ['file.con'], \ 'csv': ['file.csv'], \ 'cucumber': ['file.feature'], @@ -594,6 +593,7 @@ func s:GetFilenameChecks() abort \ 'radiance': ['file.rad', 'file.mat'], \ 'raku': ['file.pm6', 'file.p6', 'file.t6', 'file.pod6', 'file.raku', 'file.rakumod', 'file.rakudoc', 'file.rakutest'], \ 'raml': ['file.raml'], + \ 'rasi': ['file.rasi'], \ 'ratpoison': ['.ratpoisonrc', 'ratpoisonrc'], \ 'rbs': ['file.rbs'], \ 'rc': ['file.rc', 'file.rch'], -- cgit From c81ad884c754abf91b0c07f4d65f43545a6cf381 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 2 Jun 2024 05:48:50 +0800 Subject: vim-patch:8.2.4436: crash with weird 'vartabstop' value Problem: Crash with weird 'vartabstop' value. Solution: Check for running into the end of the line. https://github.com/vim/vim/commit/4e889f98e95ac05d7c8bd3ee933ab4d47820fdfa Code change is N/A as it's superseded by virtual text changes. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_vartabs.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_vartabs.vim b/test/old/testdir/test_vartabs.vim index e12c71d521..04ef211686 100644 --- a/test/old/testdir/test_vartabs.vim +++ b/test/old/testdir/test_vartabs.vim @@ -445,4 +445,16 @@ func Test_shiftwidth_vartabstop() setlocal shiftwidth& vartabstop& tabstop& endfunc +func Test_vartabstop_latin1() + let save_encoding = &encoding + new + set encoding=iso8859 + silent norm :se  + set vartabstop=400 + norm i00  + bwipe! + let &encoding = save_encoding +endfunc + + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 7cbfbd3ae1fea80fd349d703041df480e55aed23 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 2 Jun 2024 05:52:34 +0800 Subject: vim-patch:8.2.4437: vartabs test fails on MS-Windows Problem: Vartabs test fails on MS-Windows. Solution: Use iso8859-1 'encoding'. (Ken Takata, closes vim/vim#9818) https://github.com/vim/vim/commit/0f113e4f7b698fc94c1a8377afdb7249329beaee Co-authored-by: K.Takata --- test/old/testdir/test_vartabs.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_vartabs.vim b/test/old/testdir/test_vartabs.vim index 04ef211686..5eea75299f 100644 --- a/test/old/testdir/test_vartabs.vim +++ b/test/old/testdir/test_vartabs.vim @@ -448,10 +448,10 @@ endfunc func Test_vartabstop_latin1() let save_encoding = &encoding new - set encoding=iso8859 - silent norm :se  + set encoding=iso8859-1 + silent exe "norm :se \\" set vartabstop=400 - norm i00  + exe "norm i00\t\" bwipe! let &encoding = save_encoding endfunc -- cgit From 6f87779857f1b7a86da9e53c117b5b678a2a3236 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 2 Jun 2024 05:53:31 +0800 Subject: vim-patch:8.2.4452: test for what 8.2.4436 fixes does not check for regression Problem: Test for what 8.2.4436 fixes does not check for regression. Solution: Set several options. (Ken Takata, closes vim/vim#9830) https://github.com/vim/vim/commit/2dada73a4ebffe2582af472ce362abd3116b58c9 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_vartabs.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_vartabs.vim b/test/old/testdir/test_vartabs.vim index 5eea75299f..274531fdc1 100644 --- a/test/old/testdir/test_vartabs.vim +++ b/test/old/testdir/test_vartabs.vim @@ -446,14 +446,16 @@ func Test_shiftwidth_vartabstop() endfunc func Test_vartabstop_latin1() + throw "Skipped: Nvim does not support 'compatible'" let save_encoding = &encoding new set encoding=iso8859-1 - silent exe "norm :se \\" + set compatible linebreak list revins smarttab set vartabstop=400 exe "norm i00\t\" bwipe! let &encoding = save_encoding + set nocompatible linebreak& list& revins& smarttab& vartabstop& endfunc -- cgit From 0e49c3ad1a599376d0a5c229f304a06d48c56163 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 2 Jun 2024 05:47:47 +0800 Subject: vim-patch:9.1.0456: Left shift is incorrect with vartabstop and shiftwidth=0 Problem: Left shift is incorrect with vartabstop and shiftwidth=0 Solution: make tabstop_at() function aware of shift direction (Gary Johnson) The problem was that with 'vartabstop' set and 'shiftwidth' equal 0, left shifts using << were shifting the line to the wrong column. The tabstop to the right of the first character in the line was being used as the shift amount instead of the tabstop to the left of that first character. The reason was that the tabstop_at() function always returned the value of the tabstop to the right of the given column and was not accounting for the direction of the shift. The solution was to make tabstop_at() aware of the direction of the shift and to choose the tabtop accordingly. A test was added to check this behavior and make sure it doesn't regress. While at it, also fix a few indentation/alignment issues. fixes: vim/vim#14864 closes: vim/vim#14887 https://github.com/vim/vim/commit/88d4f255b7b7a19bb4f6489e0ad0956e47d51fed Co-authored-by: Gary Johnson --- test/old/testdir/test_vartabs.vim | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_vartabs.vim b/test/old/testdir/test_vartabs.vim index 274531fdc1..82c3a513f9 100644 --- a/test/old/testdir/test_vartabs.vim +++ b/test/old/testdir/test_vartabs.vim @@ -458,5 +458,64 @@ func Test_vartabstop_latin1() set nocompatible linebreak& list& revins& smarttab& vartabstop& endfunc +" Verify that right-shifting and left-shifting adjust lines to the proper +" tabstops. +func Test_vartabstop_shift_right_left() + new + set expandtab + set shiftwidth=0 + set vartabstop=17,11,7 + exe "norm! aword" + let expect = "word" + call assert_equal(expect, getline(1)) + + " Shift to first tabstop. + norm! >> + let expect = " word" + call assert_equal(expect, getline(1)) + + " Shift to second tabstop. + norm! >> + let expect = " word" + call assert_equal(expect, getline(1)) + + " Shift to third tabstop. + norm! >> + let expect = " word" + call assert_equal(expect, getline(1)) + + " Shift to fourth tabstop, repeating the third shift width. + norm! >> + let expect = " word" + call assert_equal(expect, getline(1)) + + " Shift back to the third tabstop. + norm! << + let expect = " word" + call assert_equal(expect, getline(1)) + + " Shift back to the second tabstop. + norm! << + let expect = " word" + call assert_equal(expect, getline(1)) + + " Shift back to the first tabstop. + norm! << + let expect = " word" + call assert_equal(expect, getline(1)) + + " Shift back to the left margin. + norm! << + let expect = "word" + call assert_equal(expect, getline(1)) + + " Shift again back to the left margin. + norm! << + let expect = "word" + call assert_equal(expect, getline(1)) + + bwipeout! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 659d3dcd2edf1b178a20015cab399390ffda1a32 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 2 Jun 2024 17:31:37 +0200 Subject: vim-patch:9.1.0460: filetype: lintstagedrc files are not recognized MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: filetype: lintstagedrc files are not recognized Solution: recognize '.lintstagedrc' files as json filetype (İlyas Akın) see: https://github.com/lint-staged/lint-staged closes: vim/vim#14897 https://github.com/vim/vim/commit/7577afd5efd0f7ebf0dbbca09713185024263ed7 Co-authored-by: İlyas Akın --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 88cd8fc416..fa62765398 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -365,7 +365,7 @@ func s:GetFilenameChecks() abort \ 'jq': ['file.jq'], \ 'jovial': ['file.jov', 'file.j73', 'file.jovial'], \ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file', 'org.eclipse.xyz.prefs'], - \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock'], + \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', '.lintstagedrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock'], \ 'json5': ['file.json5'], \ 'jsonc': ['file.jsonc', '.babelrc', '.eslintrc', '.jsfmtrc', '.jshintrc', '.jscsrc', '.vsconfig', '.hintrc', '.swrc', 'jsconfig.json', 'tsconfig.json', 'tsconfig.test.json', 'tsconfig-test.json', '.luaurc'], \ 'jsonl': ['file.jsonl'], -- cgit From e20c5fba2c77b7e7ea93363abc987d913e5f9f58 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 4 Jun 2024 06:07:20 +0800 Subject: vim-patch:partial:8.2.3637: typos in test files (#29172) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Typos in test files. Solution: Correct the typos. (Dominique Pellé, closes vim/vim#9175) https://github.com/vim/vim/commit/923dce2b07ff185c0ef661f3eca47bc17655f01b Co-authored-by: Dominique Pelle --- test/old/testdir/runtest.vim | 2 +- test/old/testdir/test_debugger.vim | 10 +++++----- test/old/testdir/test_diffmode.vim | 4 ++-- test/old/testdir/test_excmd.vim | 2 +- test/old/testdir/test_flatten.vim | 2 +- test/old/testdir/test_normal.vim | 6 +++--- test/old/testdir/test_options.vim | 2 +- test/old/testdir/test_quickfix.vim | 8 +++----- test/old/testdir/test_spellfile.vim | 2 +- test/old/testdir/test_syntax.vim | 3 +-- test/old/testdir/test_textobjects.vim | 2 +- test/old/testdir/test_trycatch.vim | 2 +- 12 files changed, 21 insertions(+), 24 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/runtest.vim b/test/old/testdir/runtest.vim index 2d8ba60a7e..a1d4011d7e 100644 --- a/test/old/testdir/runtest.vim +++ b/test/old/testdir/runtest.vim @@ -131,7 +131,7 @@ if has('win32') endif if has('mac') - " In MacOS, when starting a shell in a terminal, a bash deprecation warning + " In macOS, when starting a shell in a terminal, a bash deprecation warning " message is displayed. This breaks the terminal test. Disable the warning " message. let $BASH_SILENCE_DEPRECATION_WARNING = 1 diff --git a/test/old/testdir/test_debugger.vim b/test/old/testdir/test_debugger.vim index ad03443cb4..3a469e8a17 100644 --- a/test/old/testdir/test_debugger.vim +++ b/test/old/testdir/test_debugger.vim @@ -524,7 +524,7 @@ func Test_Backtrace_Through_Source() call RunDbgCmd( buf, 'down', [ 'frame is zero' ] ) - " step until we have another meaninfgul trace + " step until we have another meaningful trace call RunDbgCmd(buf, 'step', ['line 5: func File2Function()']) call RunDbgCmd(buf, 'step', ['line 9: call File2Function()']) call RunDbgCmd(buf, 'backtrace', [ @@ -611,7 +611,7 @@ func Test_Backtrace_Autocmd() \ ['cmd: doautocmd User TestGlobalFunction']) call RunDbgCmd(buf, 'step', ['cmd: call GlobalFunction() | echo "Done"']) - " At this point the ontly thing in the stack is the autocommand + " At this point the only thing in the stack is the autocommand call RunDbgCmd(buf, 'backtrace', [ \ '>backtrace', \ '->0 User Autocommands for "TestGlobalFunction"', @@ -741,7 +741,7 @@ func Test_Backtrace_Autocmd() call RunDbgCmd( buf, 'down', [ 'frame is zero' ] ) - " step until we have another meaninfgul trace + " step until we have another meaningful trace call RunDbgCmd(buf, 'step', ['line 5: func File2Function()']) call RunDbgCmd(buf, 'step', ['line 9: call File2Function()']) call RunDbgCmd(buf, 'backtrace', [ @@ -867,7 +867,7 @@ func Test_Backtrace_CmdLine() call CheckDbgOutput(buf, ['command line', \ 'cmd: call GlobalFunction()'], #{msec: 5000}) - " At this point the ontly thing in the stack is the cmdline + " At this point the only thing in the stack is the cmdline call RunDbgCmd(buf, 'backtrace', [ \ '>backtrace', \ '->0 command line', @@ -1285,7 +1285,7 @@ func Test_debug_backtrace_level() \ #{ match: 'pattern' } ) " Expression evaluation in the script frame (not the function frame) - " FIXME: Unexpected in this scope (a: should not be visibnle) + " FIXME: Unexpected in this scope (a: should not be visible) call RunDbgCmd(buf, 'echo a:arg', [ 'arg1' ] ) call RunDbgCmd(buf, 'echo s:file1_var', [ 'file1' ] ) call RunDbgCmd(buf, 'echo g:global_var', [ 'global' ] ) diff --git a/test/old/testdir/test_diffmode.vim b/test/old/testdir/test_diffmode.vim index 71483b7469..85ee5df961 100644 --- a/test/old/testdir/test_diffmode.vim +++ b/test/old/testdir/test_diffmode.vim @@ -276,7 +276,7 @@ func Test_diffget_diffput_empty_buffer() endfunc " :diffput and :diffget completes names of buffers which -" are in diff mode and which are different then current buffer. +" are in diff mode and which are different than current buffer. " No completion when the current window is not in diff mode. func Test_diffget_diffput_completion() e Xdiff1 | diffthis @@ -679,7 +679,7 @@ func Test_diffexpr() call assert_notequal(normattr, screenattr(3, 1)) diffoff! - " Try using an non-existing function for 'diffexpr'. + " Try using a non-existing function for 'diffexpr'. set diffexpr=NewDiffFunc() call assert_fails('windo diffthis', ['E117:', 'E97:']) diffoff! diff --git a/test/old/testdir/test_excmd.vim b/test/old/testdir/test_excmd.vim index 4a780078fd..a9d7c27fe5 100644 --- a/test/old/testdir/test_excmd.vim +++ b/test/old/testdir/test_excmd.vim @@ -665,7 +665,7 @@ func Sandbox_tests() if has('clientserver') call assert_fails('let s=remote_expr("gvim", "2+2")', 'E48:') if !has('win32') - " remote_foreground() doesn't thrown an error message on MS-Windows + " remote_foreground() doesn't throw an error message on MS-Windows call assert_fails('call remote_foreground("gvim")', 'E48:') endif call assert_fails('let s=remote_peek("gvim")', 'E48:') diff --git a/test/old/testdir/test_flatten.vim b/test/old/testdir/test_flatten.vim index aa91060313..035ca18f73 100644 --- a/test/old/testdir/test_flatten.vim +++ b/test/old/testdir/test_flatten.vim @@ -53,7 +53,7 @@ func Test_flatten() call test_garbagecollect_now() call assert_equal([1, 2, 3], l:list) - " Tests for checking circular reference list can be flatten. + " Tests for checking circular reference list can be flattened. let l:x = [1] let l:y = [x] let l:z = flatten(l:y) diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index a2ef07193d..47d3e67c5e 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -1522,7 +1522,7 @@ func Test_normal18_z_fold() norm! j call assert_equal('52', getline('.')) - " zA on a opened fold when foldenable is not set + " zA on an opened fold when foldenable is not set 50 set nofoldenable norm! zA @@ -1878,7 +1878,7 @@ func Test_normal23_K() let not_gnu_man = has('mac') || has('bsd') if not_gnu_man - " In MacOS and BSD, the option for specifying a pager is different + " In macOS and BSD, the option for specifying a pager is different set keywordprg=man\ -P\ cat else set keywordprg=man\ --pager=cat @@ -2727,7 +2727,7 @@ func Test_normal33_g_cmd2() call assert_equal('foo first line', getline(1)) set virtualedit& - " Test for aboring a g command using CTRL-\ CTRL-G + " Test for aborting a g command using CTRL-\ CTRL-G exe "normal! g\\" call assert_equal('foo first line', getline('.')) diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index 8ffd8f7ef8..f7eace59c2 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -1732,7 +1732,7 @@ func Test_cmdheight() set cmdheight& endfunc -" To specify a control character as a option value, '^' can be used +" To specify a control character as an option value, '^' can be used func Test_opt_control_char() set wildchar=^v call assert_equal("\", nr2char(&wildchar)) diff --git a/test/old/testdir/test_quickfix.vim b/test/old/testdir/test_quickfix.vim index a708cabc26..791186efe8 100644 --- a/test/old/testdir/test_quickfix.vim +++ b/test/old/testdir/test_quickfix.vim @@ -4353,11 +4353,9 @@ endfunc " Test for shortening/simplifying the file name when opening the " quickfix window or when displaying the quickfix list func Test_shorten_fname() - if !has('unix') - return - endif + CheckUnix %bwipe - " Create a quickfix list with a absolute path filename + " Create a quickfix list with an absolute path filename let fname = getcwd() . '/test_quickfix.vim' call setqflist([], ' ', {'lines':[fname . ":20:Line20"], 'efm':'%f:%l:%m'}) call assert_equal(fname, bufname('test_quickfix.vim')) @@ -4366,7 +4364,7 @@ func Test_shorten_fname() call assert_equal('test_quickfix.vim', bufname('test_quickfix.vim')) cclose %bwipe - " Create a quickfix list with a absolute path filename + " Create a quickfix list with an absolute path filename call setqflist([], ' ', {'lines':[fname . ":20:Line20"], 'efm':'%f:%l:%m'}) call assert_equal(fname, bufname('test_quickfix.vim')) " Displaying the quickfix list should simplify the file path diff --git a/test/old/testdir/test_spellfile.vim b/test/old/testdir/test_spellfile.vim index 4d2a6cf35f..509fed11df 100644 --- a/test/old/testdir/test_spellfile.vim +++ b/test/old/testdir/test_spellfile.vim @@ -656,7 +656,7 @@ func Test_aff_file_format_error() let output = execute('mkspell! Xtest.spl Xtest') call assert_match('Different combining flag in continued affix block in Xtest.aff line 3', output) - " Try to reuse a affix used for BAD flag + " Try to reuse an affix used for BAD flag call writefile(['BAD x', 'PFX x Y 1', 'PFX x 0 re x'], 'Xtest.aff') let output = execute('mkspell! Xtest.spl Xtest') call assert_match('Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in Xtest.aff line 2: x', output) diff --git a/test/old/testdir/test_syntax.vim b/test/old/testdir/test_syntax.vim index 35523df17d..8a24c4ae27 100644 --- a/test/old/testdir/test_syntax.vim +++ b/test/old/testdir/test_syntax.vim @@ -549,8 +549,7 @@ endfunc func Test_bg_detection() CheckNotGui - " auto-detection of &bg, make sure sure it isn't set anywhere before - " this test + " auto-detection of &bg, make sure it isn't set anywhere before this test hi Normal ctermbg=0 call assert_equal('dark', &bg) hi Normal ctermbg=4 diff --git a/test/old/testdir/test_textobjects.vim b/test/old/testdir/test_textobjects.vim index 3b86ae97da..a7840860c9 100644 --- a/test/old/testdir/test_textobjects.vim +++ b/test/old/testdir/test_textobjects.vim @@ -232,7 +232,7 @@ func Test_empty_html_tag() normal 0f Date: Tue, 4 Jun 2024 09:39:28 +0200 Subject: vim-patch:9.1.0464: no whitespace padding in commentstring option in ftplugins Problem: no whitespace padding in commentstring option in ftplugins Solution: Change default to include whitespace padding, update existing filetype plugins with the new default value (Riley Bruins) closes: vim/vim#14843 https://github.com/vim/vim/commit/0a0830624a260660c7fa692ecb7e6e5de09114ba Co-authored-by: Riley Bruins --- test/old/testdir/setup.vim | 2 +- test/old/testdir/test_fold.vim | 70 +++++++++++++++++++++++- test/old/testdir/test_normal.vim | 112 +++++++++++++++++++-------------------- 3 files changed, 125 insertions(+), 59 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/setup.vim b/test/old/testdir/setup.vim index 7313a0a162..8a5eeb3aab 100644 --- a/test/old/testdir/setup.vim +++ b/test/old/testdir/setup.vim @@ -1,7 +1,7 @@ if exists('s:did_load') " Align Nvim defaults to Vim. set backspace= - set commentstring=/*%s*/ + set commentstring=/*\ %s\ */ set complete=.,w,b,u,t,i set define=^\\s*#\\s*define set directory^=. diff --git a/test/old/testdir/test_fold.vim b/test/old/testdir/test_fold.vim index eae6952e72..b7a0cee444 100644 --- a/test/old/testdir/test_fold.vim +++ b/test/old/testdir/test_fold.vim @@ -8,7 +8,73 @@ func PrepIndent(arg) return [a:arg] + repeat(["\t".a:arg], 5) endfu -func Test_address_fold() +func Test_address_fold_new_default_commentstring() + " Test with the new commentstring defaults, that includes padding after v9.1.464 + new + call setline(1, ['int FuncName() {/* {{{ */', 1, 2, 3, 4, 5, '}/* }}} */', + \ 'after fold 1', 'after fold 2', 'after fold 3']) + setl fen fdm=marker + " The next commands should all copy the same part of the buffer, + " regardless of the addressing type, since the part to be copied + " is folded away + :1y + call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1)) + :.y + call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1)) + :.+y + call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1)) + :.,.y + call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1)) + :sil .1,.y + call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1)) + " use silent to make E493 go away + :sil .+,.y + call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1)) + :,y + call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1)) + :,+y + call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */','after fold 1'], getreg(0,1,1)) + " using .+3 as second address should c opy the whole folded line + the next 3 + " lines + :.,+3y + call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */', + \ 'after fold 1', 'after fold 2' , 'after fold 3'], getreg(0,1,1)) + :sil .,-2y + call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3', '4', '5', '}/* }}} */'], getreg(0,1,1)) + + " now test again with folding disabled + set nofoldenable + :1y + call assert_equal(['int FuncName() {/* {{{ */'], getreg(0,1,1)) + :.y + call assert_equal(['int FuncName() {/* {{{ */'], getreg(0,1,1)) + :.+y + call assert_equal(['1'], getreg(0,1,1) ) + :.,.y + call assert_equal(['int FuncName() {/* {{{ */'], getreg(0,1,1)) + " use silent to make E493 go away + :sil .1,.y + call assert_equal(['int FuncName() {/* {{{ */', '1'], getreg(0,1,1)) + " use silent to make E493 go away + :sil .+,.y + call assert_equal(['int FuncName() {/* {{{ */', '1'], getreg(0,1,1)) + :,y + call assert_equal(['int FuncName() {/* {{{ */'], getreg(0,1,1)) + :,+y + call assert_equal(['int FuncName() {/* {{{ */', '1'], getreg(0,1,1)) + " using .+3 as second address should c opy the whole folded line + the next 3 + " lines + :.,+3y + call assert_equal(['int FuncName() {/* {{{ */', '1', '2', '3'], getreg(0,1,1)) + :7 + :sil .,-2y + call assert_equal(['4', '5', '}/* }}} */'], getreg(0,1,1)) + + quit! +endfunc + +func Test_address_fold_old_default_commentstring() + " Test with the old commentstring defaults, before v9.1.464 new call setline(1, ['int FuncName() {/*{{{*/', 1, 2, 3, 4, 5, '}/*}}}*/', \ 'after fold 1', 'after fold 2', 'after fold 3']) @@ -696,7 +762,7 @@ func Test_fold_create_marker_in_C() call append(0, content) call cursor(c + 1, 1) norm! zfG - call assert_equal(content[c] . (c < 4 ? '{{{' : '/*{{{*/'), getline(c + 1)) + call assert_equal(content[c] . (c < 4 ? '{{{' : '/* {{{ */'), getline(c + 1)) endfor set fdm& fdl& diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index 47d3e67c5e..170b2cda53 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -403,17 +403,17 @@ func Test_normal08_fold() " First fold norm! V4jzf " check that folds have been created - call assert_equal(['50/*{{{*/', '51', '52', '53', '54/*}}}*/'], getline(50,54)) + call assert_equal(['50/* {{{ */', '51', '52', '53', '54/* }}} */'], getline(50,54)) " Second fold 46 norm! V10jzf " check that folds have been created - call assert_equal('46/*{{{*/', getline(46)) - call assert_equal('60/*}}}*/', getline(60)) + call assert_equal('46/* {{{ */', getline(46)) + call assert_equal('60/* }}} */', getline(60)) norm! k call assert_equal('45', getline('.')) norm! j - call assert_equal('46/*{{{*/', getline('.')) + call assert_equal('46/* {{{ */', getline('.')) norm! j call assert_equal('61', getline('.')) norm! k @@ -422,12 +422,12 @@ func Test_normal08_fold() norm! k call assert_equal('45', getline('.')) norm! j - call assert_equal('46/*{{{*/', getline('.')) + call assert_equal('46/* {{{ */', getline('.')) norm! j call assert_equal('47', getline('.')) norm! k norm! zcVzO - call assert_equal('46/*{{{*/', getline('.')) + call assert_equal('46/* {{{ */', getline('.')) norm! j call assert_equal('47', getline('.')) norm! j @@ -435,7 +435,7 @@ func Test_normal08_fold() norm! j call assert_equal('49', getline('.')) norm! j - call assert_equal('50/*{{{*/', getline('.')) + call assert_equal('50/* {{{ */', getline('.')) norm! j call assert_equal('51', getline('.')) " delete folds @@ -1387,14 +1387,14 @@ func Test_normal18_z_fold() " First fold norm! 4zF " check that folds have been created - call assert_equal(['50/*{{{*/', '51', '52', '53/*}}}*/'], getline(50,53)) + call assert_equal(['50/* {{{ */', '51', '52', '53/* }}} */'], getline(50,53)) " Test for zd 51 norm! 2zF call assert_equal(2, foldlevel('.')) norm! kzd - call assert_equal(['50', '51/*{{{*/', '52/*}}}*/', '53'], getline(50,53)) + call assert_equal(['50', '51/* {{{ */', '52/* }}} */', '53'], getline(50,53)) norm! j call assert_equal(1, foldlevel('.')) @@ -1413,7 +1413,7 @@ func Test_normal18_z_fold() norm! 2zF 90 norm! 4zF - call assert_equal(['85/*{{{*/', '86/*{{{*/', '87/*}}}*/', '88/*}}}*/', '89', '90/*{{{*/', '91', '92', '93/*}}}*/'], getline(85,93)) + call assert_equal(['85/* {{{ */', '86/* {{{ */', '87/* }}} */', '88/* }}} */', '89', '90/* {{{ */', '91', '92', '93/* }}} */'], getline(85,93)) norm! zE call assert_equal(['85', '86', '87', '88', '89', '90', '91', '92', '93'], getline(85,93)) @@ -1425,9 +1425,9 @@ func Test_normal18_z_fold() norm! k call assert_equal('49', getline('.')) norm! j - call assert_equal('50/*{{{*/', getline('.')) + call assert_equal('50/* {{{ */', getline('.')) norm! j - call assert_equal('51/*}}}*/', getline('.')) + call assert_equal('51/* }}} */', getline('.')) norm! j call assert_equal('52', getline('.')) call assert_equal(0, &foldenable) @@ -1437,7 +1437,7 @@ func Test_normal18_z_fold() norm! zN call assert_equal('49', getline('.')) norm! j - call assert_equal('50/*{{{*/', getline('.')) + call assert_equal('50/* {{{ */', getline('.')) norm! j call assert_equal('52', getline('.')) call assert_equal(1, &foldenable) @@ -1458,9 +1458,9 @@ func Test_normal18_z_fold() norm! k call assert_equal('49', getline('.')) norm! j - call assert_equal('50/*{{{*/', getline('.')) + call assert_equal('50/* {{{ */', getline('.')) norm! j - call assert_equal('51/*}}}*/', getline('.')) + call assert_equal('51/* }}} */', getline('.')) norm! j call assert_equal('52', getline('.')) 50 @@ -1468,7 +1468,7 @@ func Test_normal18_z_fold() norm! k call assert_equal('49', getline('.')) norm! j - call assert_equal('50/*{{{*/', getline('.')) + call assert_equal('50/* {{{ */', getline('.')) norm! j call assert_equal('52', getline('.')) @@ -1477,14 +1477,14 @@ func Test_normal18_z_fold() norm! k call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j call assert_equal('55', getline('.')) 49 norm! za - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j - call assert_equal('50/*{{{*/', getline('.')) + call assert_equal('50/* {{{ */', getline('.')) norm! j call assert_equal('52', getline('.')) set nofoldenable @@ -1498,11 +1498,11 @@ func Test_normal18_z_fold() norm! 2k call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j - call assert_equal('50/*{{{*/', getline('.')) + call assert_equal('50/* {{{ */', getline('.')) norm! j - call assert_equal('51/*}}}*/', getline('.')) + call assert_equal('51/* }}} */', getline('.')) norm! j call assert_equal('52', getline('.')) @@ -1514,11 +1514,11 @@ func Test_normal18_z_fold() norm! 2k call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j - call assert_equal('50/*{{{*/', getline('.')) + call assert_equal('50/* {{{ */', getline('.')) norm! j - call assert_equal('51/*}}}*/', getline('.')) + call assert_equal('51/* }}} */', getline('.')) norm! j call assert_equal('52', getline('.')) @@ -1530,7 +1530,7 @@ func Test_normal18_z_fold() norm! k call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j call assert_equal('55', getline('.')) @@ -1550,7 +1550,7 @@ func Test_normal18_z_fold() norm! k call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j call assert_equal('55', getline('.')) set nofoldenable @@ -1559,7 +1559,7 @@ func Test_normal18_z_fold() norm! k call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j call assert_equal('55', getline('.')) @@ -1569,7 +1569,7 @@ func Test_normal18_z_fold() norm! zCk call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j call assert_equal('55', getline('.')) @@ -1580,7 +1580,7 @@ func Test_normal18_z_fold() norm! zx call assert_equal(1, &foldenable) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j call assert_equal('55', getline('.')) @@ -1592,17 +1592,17 @@ func Test_normal18_z_fold() norm! 3k call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j - call assert_equal('50/*{{{*/', getline('.')) + call assert_equal('50/* {{{ */', getline('.')) norm! j - call assert_equal('51/*}}}*/', getline('.')) + call assert_equal('51/* }}} */', getline('.')) norm! j call assert_equal('52', getline('.')) norm! j call assert_equal('53', getline('.')) norm! j - call assert_equal('54/*}}}*/', getline('.')) + call assert_equal('54/* }}} */', getline('.')) norm! j call assert_equal('55', getline('.')) @@ -1614,15 +1614,15 @@ func Test_normal18_z_fold() call assert_equal(1, &foldenable) call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j - call assert_equal('50/*{{{*/', getline('.')) + call assert_equal('50/* {{{ */', getline('.')) norm! j call assert_equal('52', getline('.')) norm! j call assert_equal('53', getline('.')) norm! j - call assert_equal('54/*}}}*/', getline('.')) + call assert_equal('54/* }}} */', getline('.')) norm! j call assert_equal('55', getline('.')) @@ -1635,7 +1635,7 @@ func Test_normal18_z_fold() norm! k call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j call assert_equal('55', getline('.')) @@ -1652,7 +1652,7 @@ func Test_normal18_z_fold() norm! k call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j call assert_equal('55', getline('.')) @@ -1671,7 +1671,7 @@ func Test_normal18_z_fold() call assert_equal(0, &foldlevel) call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j call assert_equal('55', getline('.')) @@ -1689,11 +1689,11 @@ func Test_normal18_z_fold() call assert_equal(2, &foldlevel) call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j - call assert_equal('50/*{{{*/', getline('.')) + call assert_equal('50/* {{{ */', getline('.')) norm! j - call assert_equal('51/*}}}*/', getline('.')) + call assert_equal('51/* }}} */', getline('.')) norm! j call assert_equal('52', getline('.')) @@ -1709,24 +1709,24 @@ func Test_normal18_z_fold() call assert_equal(2, &foldlevel) call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j - call assert_equal('50/*{{{*/', getline('.')) + call assert_equal('50/* {{{ */', getline('.')) norm! j - call assert_equal('51/*}}}*/', getline('.')) + call assert_equal('51/* }}} */', getline('.')) norm! j call assert_equal('52', getline('.')) - call append(50, ['a /*{{{*/', 'b /*}}}*/']) + call append(50, ['a /* {{{ */', 'b /* }}} */']) 48 call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j - call assert_equal('50/*{{{*/', getline('.')) + call assert_equal('50/* {{{ */', getline('.')) norm! j - call assert_equal('a /*{{{*/', getline('.')) + call assert_equal('a /* {{{ */', getline('.')) norm! j - call assert_equal('51/*}}}*/', getline('.')) + call assert_equal('51/* }}} */', getline('.')) norm! j call assert_equal('52', getline('.')) 48 @@ -1735,15 +1735,15 @@ func Test_normal18_z_fold() call assert_equal(3, &foldlevel) call assert_equal('48', getline('.')) norm! j - call assert_equal('49/*{{{*/', getline('.')) + call assert_equal('49/* {{{ */', getline('.')) norm! j - call assert_equal('50/*{{{*/', getline('.')) + call assert_equal('50/* {{{ */', getline('.')) norm! j - call assert_equal('a /*{{{*/', getline('.')) + call assert_equal('a /* {{{ */', getline('.')) norm! j - call assert_equal('b /*}}}*/', getline('.')) + call assert_equal('b /* }}} */', getline('.')) norm! j - call assert_equal('51/*}}}*/', getline('.')) + call assert_equal('51/* }}} */', getline('.')) norm! j call assert_equal('52', getline('.')) -- cgit From 164338330b74e6e7c7cbb61e49c810dd82599236 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 5 Jun 2024 14:44:31 +0800 Subject: vim-patch:9.1.0463: no fuzzy-matching support for insert-completion Problem: no fuzzy-matching support for insert-completion Solution: enable insert-mode completion with fuzzy-matching using :set completopt+=fuzzy (glepnir). closes: vim/vim#14878 https://github.com/vim/vim/commit/a218cc6cdabae1113647b817c4eefc2b60a6902f Co-authored-by: glepnir --- test/old/testdir/test_ins_complete.vim | 56 ++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 45db2a7364..ba5e5acce9 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2512,4 +2512,60 @@ func Test_completefunc_first_call_complete_add() bwipe! endfunc +func Test_complete_fuzzy_match() + func OnPumChange() + let g:item = get(v:event, 'completed_item', {}) + let g:word = get(g:item, 'word', v:null) + endfunction + + augroup AAAAA_Group + au! + autocmd CompleteChanged * :call OnPumChange() + augroup END + + func Omni_test(findstart, base) + if a:findstart + return col(".") + endif + return [#{word: "foo"}, #{word: "foobar"}, #{word: "fooBaz"}, #{word: "foobala"}] + endfunc + new + set omnifunc=Omni_test + set completeopt+=noinsert,fuzzy + call feedkeys("Gi\\", 'tx') + call assert_equal('foo', g:word) + call feedkeys("S\\fb", 'tx') + call assert_equal('fooBaz', g:word) + call feedkeys("S\\fa", 'tx') + call assert_equal('foobar', g:word) + " select next + call feedkeys("S\\fb\", 'tx') + call assert_equal('foobar', g:word) + " can circly select next + call feedkeys("S\\fb\\\", 'tx') + call assert_equal(v:null, g:word) + " select prev + call feedkeys("S\\fb\", 'tx') + call assert_equal(v:null, g:word) + " can circly select prev + call feedkeys("S\\fb\\\\", 'tx') + call assert_equal('fooBaz', g:word) + + " respect noselect + set completeopt+=noselect + call feedkeys("S\\fb", 'tx') + call assert_equal(v:null, g:word) + call feedkeys("S\\fb\", 'tx') + call assert_equal('fooBaz', g:word) + + " clean up + set omnifunc= + bw! + set complete& completeopt& + autocmd! AAAAA_Group + augroup! AAAAA_Group + delfunc OnPumChange + delfunc Omni_test +endfunc + " vim: shiftwidth=2 sts=2 expandtab nofoldenable -- cgit From c235a063d6ead447f13076be50ddd9fae6223913 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 6 Jun 2024 05:49:04 +0800 Subject: vim-patch:9.1.0467: typos in some comments Problem: typos in some comments (after v9.1.0466) Solution: fix comments (zeertzjq) closes: vim/vim#14919 https://github.com/vim/vim/commit/551d8c372e49ed630fd95c6422a0ee62d00902c5 --- test/old/testdir/test_ins_complete.vim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index ba5e5acce9..573cd9729c 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2529,6 +2529,7 @@ func Test_complete_fuzzy_match() endif return [#{word: "foo"}, #{word: "foobar"}, #{word: "fooBaz"}, #{word: "foobala"}] endfunc + new set omnifunc=Omni_test set completeopt+=noinsert,fuzzy @@ -2541,13 +2542,13 @@ func Test_complete_fuzzy_match() " select next call feedkeys("S\\fb\", 'tx') call assert_equal('foobar', g:word) - " can circly select next + " can cyclically select next call feedkeys("S\\fb\\\", 'tx') call assert_equal(v:null, g:word) " select prev call feedkeys("S\\fb\", 'tx') call assert_equal(v:null, g:word) - " can circly select prev + " can cyclically select prev call feedkeys("S\\fb\\\\", 'tx') call assert_equal('fooBaz', g:word) @@ -2566,6 +2567,8 @@ func Test_complete_fuzzy_match() augroup! AAAAA_Group delfunc OnPumChange delfunc Omni_test + unlet g:item + unlet g:word endfunc " vim: shiftwidth=2 sts=2 expandtab nofoldenable -- cgit From 1d4e894403638a94ac58766cdcbc7f3128db318b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 6 Jun 2024 05:50:44 +0800 Subject: vim-patch:9.1.0469: Cannot have buffer-local value for 'completeopt' Problem: Cannot have buffer-local value for 'completeopt' (Nick Jensen). Solution: Make 'completeopt' global-local (zeertzjq). Also for some reason test Test_ColonEight_MultiByte seems to be failing sporadically now. Let's mark it as flaky. fixes: vim/vim#5487 closes: vim/vim#14922 https://github.com/vim/vim/commit/529b9ad62a0e843ee56ef609aef7e51b7dc8a4c8 --- test/old/testdir/test_ins_complete.vim | 68 ++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 573cd9729c..fd77da67f8 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -884,6 +884,74 @@ func Test_complete_with_longest() bwipe! endfunc +" Test for buffer-local value of 'completeopt' +func Test_completeopt_buffer_local() + set completeopt=menu + new + call setline(1, ['foofoo', 'foobar', 'foobaz', '']) + call assert_equal('', &l:completeopt) + call assert_equal('menu', &completeopt) + call assert_equal('menu', &g:completeopt) + + setlocal bufhidden=hide + enew + call setline(1, ['foofoo', 'foobar', 'foobaz', '']) + call assert_equal('', &l:completeopt) + call assert_equal('menu', &completeopt) + call assert_equal('menu', &g:completeopt) + + setlocal completeopt+=fuzzy,noinsert + call assert_equal('menu,fuzzy,noinsert', &l:completeopt) + call assert_equal('menu,fuzzy,noinsert', &completeopt) + call assert_equal('menu', &g:completeopt) + call feedkeys("Gccf\\bz\", 'tnix') + call assert_equal('foobaz', getline('.')) + + setlocal completeopt= + call assert_equal('', &l:completeopt) + call assert_equal('menu', &completeopt) + call assert_equal('menu', &g:completeopt) + call feedkeys("Gccf\\\", 'tnix') + call assert_equal('foofoo', getline('.')) + + setlocal completeopt+=longest + call assert_equal('menu,longest', &l:completeopt) + call assert_equal('menu,longest', &completeopt) + call assert_equal('menu', &g:completeopt) + call feedkeys("Gccf\\\\", 'tnix') + call assert_equal('foo', getline('.')) + + setlocal bufhidden=hide + buffer # + call assert_equal('', &l:completeopt) + call assert_equal('menu', &completeopt) + call assert_equal('menu', &g:completeopt) + call feedkeys("Gccf\\\", 'tnix') + call assert_equal('foofoo', getline('.')) + + setlocal completeopt+=fuzzy,noinsert + call assert_equal('menu,fuzzy,noinsert', &l:completeopt) + call assert_equal('menu,fuzzy,noinsert', &completeopt) + call assert_equal('menu', &g:completeopt) + call feedkeys("Gccf\\bz\", 'tnix') + call assert_equal('foobaz', getline('.')) + + buffer # + call assert_equal('menu,longest', &l:completeopt) + call assert_equal('menu,longest', &completeopt) + call assert_equal('menu', &g:completeopt) + call feedkeys("Gccf\\\\", 'tnix') + call assert_equal('foo', getline('.')) + + setlocal bufhidden=wipe + buffer! # + bwipe! + call assert_equal('', &l:completeopt) + call assert_equal('menu', &completeopt) + call assert_equal('menu', &g:completeopt) + + set completeopt& +endfunc " Test for completing words following a completed word in a line func Test_complete_wrapscan() -- cgit From 1dcda865591b9bdda2fec1a1860efb4df56ea533 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Mon, 10 Jun 2024 16:55:16 +0200 Subject: fix(column): clamp line number for legacy signs Problem: Legacy :sign API still allows placing signs beyond the end of the buffer. This is unaccounted for by the signcolumn tracking logic and is disallowed in general for the extmark API which implements it now. Solution: Clamp legacy sign line number to the length of the buffer. --- test/old/testdir/test_signs.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_signs.vim b/test/old/testdir/test_signs.vim index d7baa7e870..69fefccb3f 100644 --- a/test/old/testdir/test_signs.vim +++ b/test/old/testdir/test_signs.vim @@ -89,8 +89,9 @@ func Test_sign() " Place a sign without specifying the filename or buffer sign place 77 line=9 name=Sign2 let a=execute('sign place') + " Nvim: sign line clamped to buffer length call assert_equal("\n--- Signs ---\nSigns for [NULL]:\n" . - \ " line=9 id=77 name=Sign2 priority=10\n", a) + \ " line=4 id=77 name=Sign2 priority=10\n", a) sign unplace * " Check :jump with file=... @@ -799,10 +800,11 @@ func Test_sign_group() set buftype=nofile sign place 25 line=76 name=sign1 priority=99 file=foo let a = execute('sign place') + " Nvim: sign line clamped to buffer length call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . \ " line=10 id=5 name=sign1 priority=10\n" . \ "Signs for foo:\n" . - \ " line=76 id=25 name=sign1 priority=99\n", a) + \ " line=1 id=25 name=sign1 priority=99\n", a) close bwipe foo -- cgit From 033810ba23c25a98b7aeb703d1d61463bfcab503 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 12 Jun 2024 11:07:36 +0800 Subject: vim-patch:9.1.0477: block_editing errors out when using (#29294) Problem: block_editing errors out when using (Ali Rizvi-Santiago, after v9.1.0274) Solution: Change ins_len from size_t to int so that the test if ins_len is negative actually works properly Add a test, so that this doesn't regress. fixes: vim/vim#14960 https://github.com/vim/vim/commit/1fb9eae5794c3f808468fbc2935c5144f9e0b5b1 Co-authored-by: Christian Brabandt --- test/old/testdir/test_visual.vim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_visual.vim b/test/old/testdir/test_visual.vim index 0b840944bf..5307c49012 100644 --- a/test/old/testdir/test_visual.vim +++ b/test/old/testdir/test_visual.vim @@ -2709,4 +2709,13 @@ func Test_visual_block_cursor_delete() bwipe! endfunc +func Test_visual_block_cursor_insert_enter() + new + call setline(1, ['asdf asdf', 'asdf asdf', 'asdf asdf', 'asdf asdf']) + call cursor(1, 5) + exe ":norm! \3jcw\" + call assert_equal(['asdfw', 'asdf', 'asdfasdf', 'asdfasdf', 'asdfasdf'], getline(1, '$')) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 6b022f9d8bb7b3610384dbcbba336583f2109b5e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 14 Jun 2024 05:48:23 +0800 Subject: vim-patch:9.1.0483: glob() not sufficiently tested (#29323) Problem: glob() not sufficiently tested Solution: Add more tests for directory containing [] chars related: vim/vim#14991 https://github.com/vim/vim/commit/8b34aea1b0431082a062ecfb5de0f244f3f23418 Co-authored-by: Christian Brabandt --- test/old/testdir/test_functions.vim | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index fa9ae63381..81e843ba8d 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -3448,6 +3448,33 @@ func Test_glob() call assert_fails("call glob('*', 0, {})", 'E728:') endfunc +func Test_glob2() + call mkdir('[XglobDir]', 'R') + call mkdir('abc[glob]def', 'R') + + call writefile(['glob'], '[XglobDir]/Xglob') + call writefile(['glob'], 'abc[glob]def/Xglob') + if has("unix") + call assert_equal([], (glob('[XglobDir]/*', 0, 1))) + call assert_equal([], (glob('abc[glob]def/*', 0, 1))) + call assert_equal(['[XglobDir]/Xglob'], (glob('\[XglobDir]/*', 0, 1))) + call assert_equal(['abc[glob]def/Xglob'], (glob('abc\[glob]def/*', 0, 1))) + elseif has("win32") + let _sl=&shellslash + call assert_equal([], (glob('[XglobDir]\*', 0, 1))) + call assert_equal([], (glob('abc[glob]def\*', 0, 1))) + call assert_equal([], (glob('\[XglobDir]\*', 0, 1))) + call assert_equal([], (glob('abc\[glob]def\*', 0, 1))) + set noshellslash + call assert_equal(['[XglobDir]\Xglob'], (glob('[[]XglobDir]/*', 0, 1))) + call assert_equal(['abc[glob]def\Xglob'], (glob('abc[[]glob]def/*', 0, 1))) + set shellslash + call assert_equal(['[XglobDir]/Xglob'], (glob('[[]XglobDir]/*', 0, 1))) + call assert_equal(['abc[glob]def/Xglob'], (glob('abc[[]glob]def/*', 0, 1))) + let &shellslash=_sl + endif +endfunc + " Test for browse() func Test_browse() CheckFeature browse -- cgit From 29e05cfb7ecd2abeac397c2ef2466166d18e1f41 Mon Sep 17 00:00:00 2001 From: Yinzuo Jiang Date: Fri, 14 Jun 2024 16:37:38 +0800 Subject: vim-patch:partial:9.1.0482: termdebug plugin needs more love (#29329) Problem: termdebug plugin needs more love Solution: start with some more Vim9 refactoring to improve maintenance and readability (Ubaldo Tiberi) List of Changes and the Reasoning Behind Them: 1) Introduction of InitScriptVariables() Function: Reasoning: This function has been introduced to ensure that when you open and close Termdebug, and then open it again, there are no leftover script variable values from the previous session. Leftover values could potentially cause issues. The goal is for each Termdebug session to be independent of previous sessions. At startup, all script variables are initialized. The only exception is g:termdebug_loaded located at the very beginning of the script to prevent sourcing the script twice. The variables are declared at script level and defined in InitScriptVariables(). 2) More Descriptive Variable Names: Reasoning: The names of variables have been made more comprehensive. Almost every Termdebug buffer now has a variable to indicate its name and another variable to indicate its number, improving code readability and maintainability. Due to the latest discussion around the &mousemodel option save/restore mechanism, perhaps some other variables shall be prepended with saved_. 3) Consistent Naming for GDB Terminal Buffers: Reasoning: The name of the GDB terminal buffer now matches the name of the GDB program being used, e.g., 'gdb', 'mygdb', 'arm-eabi-none-gdb', etc. This ensures clarity and consistency in identifying buffers. 4) Other minor improvements: Moved EchoErr() on top, added another test, some refactoring, mainly changed several 0 and 1 to true and false closes: vim/vim#14980 https://github.com/vim/vim/commit/ef8eab86e29091eaff0d3fb0bc3f7c90f468f6aa Co-authored-by: Ubaldo Tiberi --- test/old/testdir/test_termdebug.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_termdebug.vim b/test/old/testdir/test_termdebug.vim index fd0c850577..38278cb326 100644 --- a/test/old/testdir/test_termdebug.vim +++ b/test/old/testdir/test_termdebug.vim @@ -340,5 +340,16 @@ func Test_termdebug_bufnames() unlet g:termdebug_config endfunc +function Test_termdebug_save_restore_variables() + let &mousemodel='' + Termdebug + call WaitForAssert({-> assert_equal(3, winnr('$'))}) + call WaitForAssert({-> assert_match(&mousemodel, 'popup_setpos')}) + wincmd t + quit! + call WaitForAssert({-> assert_equal(1, winnr('$'))}) + call WaitForAssert({-> assert_true(empty(&mousemodel))}) +endfunction + " vim: shiftwidth=2 sts=2 expandtab -- cgit From fd950d4998a497cb4258d35af72408105900296a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 15 Jun 2024 04:33:19 +0800 Subject: vim-patch:9.1.0484: Sorting of completeopt+=fuzzy is not stable (#29338) Problem: Sorting of completeopt+=fuzzy is not stable. Solution: Compare original indexes when scores are the same. (zeertzjq) closes: vim/vim#14988 https://github.com/vim/vim/commit/8e56747fd26b3b040b6fcbfb6be41b7d5922c6b5 --- test/old/testdir/test_ins_complete.vim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index fd77da67f8..ac08da9743 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2639,4 +2639,24 @@ func Test_complete_fuzzy_match() unlet g:word endfunc +" Check that tie breaking is stable for completeopt+=fuzzy (which should +" behave the same on different platforms). +func Test_complete_fuzzy_match_tie() + new + set completeopt+=fuzzy,noselect + call setline(1, ['aaabbccc', 'aaabbCCC', 'aaabbcccc', 'aaabbCCCC', '']) + + call feedkeys("Gcc\\ab\\", 'tx') + call assert_equal('aaabbccc', getline('.')) + call feedkeys("Gcc\\ab\\\", 'tx') + call assert_equal('aaabbCCC', getline('.')) + call feedkeys("Gcc\\ab\\\\", 'tx') + call assert_equal('aaabbcccc', getline('.')) + call feedkeys("Gcc\\ab\\\\\", 'tx') + call assert_equal('aaabbCCCC', getline('.')) + + bwipe! + set completeopt& +endfunc + " vim: shiftwidth=2 sts=2 expandtab nofoldenable -- cgit From dc4037f612c6f3bbc76890adfa638d48ec238eee Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 13 Jun 2024 14:08:50 +0800 Subject: vim-patch:9.1.0476: Cannot see matched text in popup menu Problem: Cannot see matched text in popup menu Solution: Introduce 2 new highlighting groups: PmenuMatch and PmenuMatchSel (glepnir) closes: vim/vim#14694 https://github.com/vim/vim/commit/40c1c3317d92f8c2adadf744fab72e4458e2a9fa Co-authored-by: glepnir --- test/old/testdir/test_popup.vim | 67 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 5ae2ed5ed5..acebcae1dd 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1348,4 +1348,71 @@ func Test_pum_highlights_custom() call StopVimInTerminal(buf) endfunc +" Test match relate highlight group in pmenu +func Test_pum_highlights_match() + CheckScreendump + let lines =<< trim END + func Omni_test(findstart, base) + if a:findstart + return col(".") + endif + return { + \ 'words': [ + \ { 'word': 'foo',}, + \ { 'word': 'foobar',}, + \ { 'word': 'fooBaz',}, + \ { 'word': 'foobala',}, + \ { 'word': '你好',}, + \ { 'word': '你好吗',}, + \ { 'word': '你不好吗',}, + \ { 'word': '你可好吗',}, + \]} + endfunc + set omnifunc=Omni_test + set completeopt=menu,noinsert,fuzzy + hi PmenuMatchSel ctermfg=6 ctermbg=225 + hi PmenuMatch ctermfg=4 ctermbg=225 + END + call writefile(lines, 'Xscript', 'D') + let buf = RunVimInTerminal('-S Xscript', {}) + call TermWait(buf) + call term_sendkeys(buf, "i\\") + call TermWait(buf, 50) + call term_sendkeys(buf, "fo") + call TermWait(buf, 50) + call VerifyScreenDump(buf, 'Test_pum_highlights_03', {}) + call term_sendkeys(buf, "\S\\") + call TermWait(buf, 50) + call term_sendkeys(buf, "你") + call TermWait(buf, 50) + call VerifyScreenDump(buf, 'Test_pum_highlights_04', {}) + call term_sendkeys(buf, "吗") + call TermWait(buf, 50) + call VerifyScreenDump(buf, 'Test_pum_highlights_05', {}) + + if has('rightleft') + call term_sendkeys(buf, "\\u:set rightleft\") + call TermWait(buf, 50) + call term_sendkeys(buf, "i\\") + call TermWait(buf, 50) + call term_sendkeys(buf, "fo") + call TermWait(buf, 50) + call VerifyScreenDump(buf, 'Test_pum_highlights_06', {}) + call term_sendkeys(buf, "\\u:set norightleft\") + call TermWait(buf) + endif + + call term_sendkeys(buf, ":set completeopt-=fuzzy\") + call TermWait(buf) + call term_sendkeys(buf, "\S\\") + call TermWait(buf, 50) + call term_sendkeys(buf, "fo") + call TermWait(buf, 50) + call VerifyScreenDump(buf, 'Test_pum_highlights_07', {}) + + call term_sendkeys(buf, "\\u") + call TermWait(buf) + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From aacd6c440d21bea9dbe9588da076d3351f9b228c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 15 Jun 2024 04:47:53 +0800 Subject: vim-patch:9.1.0485: Matched text shouldn't be highlighted in "kind" and "menu" Problem: Matched text shouldn't be highlighted in "kind" and "menu". Solution: Pass hlf_T instead of the attribute. Fix indent. (zeertzjq) closes: vim/vim#14996 https://github.com/vim/vim/commit/afbe5359e981e5d19ad23c394aefe60395c3648e --- test/old/testdir/test_popup.vim | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index acebcae1dd..e370484b28 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1358,14 +1358,14 @@ func Test_pum_highlights_match() endif return { \ 'words': [ - \ { 'word': 'foo',}, - \ { 'word': 'foobar',}, - \ { 'word': 'fooBaz',}, - \ { 'word': 'foobala',}, - \ { 'word': '你好',}, - \ { 'word': '你好吗',}, - \ { 'word': '你不好吗',}, - \ { 'word': '你可好吗',}, + \ { 'word': 'foo', 'kind': 'fookind' }, + \ { 'word': 'foobar', 'kind': 'fookind' }, + \ { 'word': 'fooBaz', 'kind': 'fookind' }, + \ { 'word': 'foobala', 'kind': 'fookind' }, + \ { 'word': '你好' }, + \ { 'word': '你好吗' }, + \ { 'word': '你不好吗' }, + \ { 'word': '你可好吗' }, \]} endfunc set omnifunc=Omni_test -- cgit From 199d852d9f8584217be38efb56b725aa3db62931 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 15 Jun 2024 07:20:38 +0800 Subject: vim-patch:9.1.0487: completed item not update on fuzzy completion (#29341) Problem: completed item not update on fuzzy completion Solution: reset compl_shown_match when at original match position (glepnir) closes: vim/vim#14955 https://github.com/vim/vim/commit/f94c9c482a6dd488f0136ac99499eb6e2ab3ccca Co-authored-by: glepnir --- test/old/testdir/test_ins_complete.vim | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index ac08da9743..f8fed8d16c 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2620,6 +2620,13 @@ func Test_complete_fuzzy_match() call feedkeys("S\\fb\\\\", 'tx') call assert_equal('fooBaz', g:word) + func Comp() + call complete(col('.'), ["fooBaz", "foobar", "foobala"]) + return '' + endfunc + call feedkeys("i\=Comp()\", 'tx') + call assert_equal('fooBaz', g:word) + " respect noselect set completeopt+=noselect call feedkeys("S\\fb", 'tx') @@ -2635,6 +2642,7 @@ func Test_complete_fuzzy_match() augroup! AAAAA_Group delfunc OnPumChange delfunc Omni_test + delfunc Comp unlet g:item unlet g:word endfunc -- cgit From 4faad4a950c68689166f0d6ecf5694cb04a9b589 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 15 Jun 2024 10:07:36 +0200 Subject: vim-patch:9.1.0486: filetype: Snakemake files are not recognized Problem: filetype: Snakemake files are not recognized Solution: Detect '*.smk' and Snakefile files as snakemake filetype (Riley Bruins) See: https://snakemake.readthedocs.io/en/stable/snakefiles/deployment.html#distribution-and-reproducibility closes: vim/vim#14992 https://github.com/vim/vim/commit/82a579e15ad78f4b99d2957300da3076ccc7d378 Co-authored-by: Riley Bruins Co-authored-by: zeertzjq --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index fa62765398..8bbda1dc99 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -670,6 +670,7 @@ func s:GetFilenameChecks() abort \ 'smith': ['file.smt', 'file.smith'], \ 'smithy': ['file.smithy'], \ 'sml': ['file.sml'], + \ 'snakemake': ['file.smk', 'Snakefile'], \ 'snobol4': ['file.sno', 'file.spt'], \ 'solidity': ['file.sol'], \ 'solution': ['file.sln'], -- cgit From 203540926df0ac6faae02e35ad12ae0221e210f6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 15 Jun 2024 22:37:48 +0800 Subject: vim-patch:9.1.0491: Cmdline pum doesn't work properly with 'rightleft' (#29355) Problem: Cmdline pum doesn't work properly with 'rightleft'. Solution: Don't use curwin->w_p_rl in cmdline mode in pum_redraw(). Use a static variable since pum_may_redraw() may be called in any mode. Also correct position of other popups with 'rightleft'. (zeertzjq) closes: vim/vim#15005 https://github.com/vim/vim/commit/883018feff43413813770dd1e13d4f950aa38524 --- test/old/testdir/test_cmdline.vim | 18 ++++++++++++++++++ test/old/testdir/test_popup.vim | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index 443539fbfd..f83f782817 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -2905,6 +2905,24 @@ func Test_wildmenu_pum_odd_wildchar() call StopVimInTerminal(buf) endfunc +" Test that 'rightleft' should not affect cmdline completion popup menu. +func Test_wildmenu_pum_rightleft() + CheckFeature rightleft + CheckScreendump + + let lines =<< trim END + set wildoptions=pum + set rightleft + END + call writefile(lines, 'Xwildmenu_pum_rl', 'D') + let buf = RunVimInTerminal('-S Xwildmenu_pum_rl', #{rows: 10, cols: 50}) + + call term_sendkeys(buf, ":sign \") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_rl', {}) + + call StopVimInTerminal(buf) +endfunc + " Test for completion after a :substitute command followed by a pipe (|) " character func Test_cmdline_complete_substitute() diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index e370484b28..b6b8b44f82 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -910,6 +910,13 @@ func Test_popup_command_dump() call term_sendkeys(buf, "\") + if has('rightleft') + call term_sendkeys(buf, ":set rightleft\") + call term_sendkeys(buf, "/X\:popup PopUp\") + call VerifyScreenDump(buf, 'Test_popup_command_rl', {}) + call term_sendkeys(buf, "\:set norightleft\") + endif + " Set a timer to change a menu entry while it's displayed. The text should " not change but the command does. Making the screendump also verifies that " "changed" shows up, which means the timer triggered. @@ -932,6 +939,37 @@ func Test_popup_command_dump() call StopVimInTerminal(buf) endfunc +" Test position of right-click menu when clicking near window edge. +func Test_mouse_popup_position() + CheckFeature menu + CheckScreendump + + let script =<< trim END + set mousemodel=popup_setpos + source $VIMRUNTIME/menu.vim + call setline(1, join(range(20))) + func Trigger(col) + call test_setmouse(1, a:col) + call feedkeys("\", 't') + endfunc + END + call writefile(script, 'XmousePopupPosition', 'D') + let buf = RunVimInTerminal('-S XmousePopupPosition', #{rows: 20, cols: 50}) + + call term_sendkeys(buf, ":call Trigger(45)\") + call VerifyScreenDump(buf, 'Test_mouse_popup_position_01', {}) + call term_sendkeys(buf, "\") + + if has('rightleft') + call term_sendkeys(buf, ":set rightleft\") + call term_sendkeys(buf, ":call Trigger(50 + 1 - 45)\") + call VerifyScreenDump(buf, 'Test_mouse_popup_position_02', {}) + call term_sendkeys(buf, "\:set norightleft\") + endif + + call StopVimInTerminal(buf) +endfunc + func Test_popup_complete_backwards() new call setline(1, ['Post', 'Port', 'Po']) -- cgit From aa319da4024a77b0f7c40e08c6f5d5b512a7f899 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 16 Jun 2024 07:07:06 +0800 Subject: vim-patch:9.1.0489: default completion may break with fuzzy (#29364) Problem: default completion may break with fuzzy Solution: check that completion_match_array is not null (glepnir) closes: vim/vim#15010 https://github.com/vim/vim/commit/aced8c2f4fd1cf3f8ac7cdb0dd54d19ef4390ef8 Co-authored-by: glepnir --- test/old/testdir/test_ins_complete.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index f8fed8d16c..96e37bd673 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2634,6 +2634,16 @@ func Test_complete_fuzzy_match() call feedkeys("S\\fb\", 'tx') call assert_equal('fooBaz', g:word) + " avoid break default completion behavior + set completeopt=fuzzy,menu + call setline(1, ['hello help hero h']) + exe "norm! A\\" + call assert_equal('hello help hero hello', getline('.')) + set completeopt+=noinsert + call setline(1, ['hello help hero h']) + exe "norm! A\\" + call assert_equal('hello help hero h', getline('.')) + " clean up set omnifunc= bw! -- cgit From 57c377dfb203e8c7b2e736669f4ba986cc2ebbbd Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 16 Jun 2024 17:30:15 +0800 Subject: vim-patch:9.1.0493: Test for patch 9.1.0489 doesn't fail without the fix (#29366) Problem: Test for patch 9.1.0489 doesn't fail without the fix. Solution: Use "!" flag of feedkeys() so that ex_normal_busy is not set and ins_compl_check_keys() is not skipped (zeertzjq). closes: vim/vim#15018 https://github.com/vim/vim/commit/acc87469415ba10283e5a53a8a11424f4867bbcf --- test/old/testdir/test_ins_complete.vim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 96e37bd673..0f974ebb5b 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2634,14 +2634,17 @@ func Test_complete_fuzzy_match() call feedkeys("S\\fb\", 'tx') call assert_equal('fooBaz', g:word) - " avoid break default completion behavior + " avoid breaking default completion behavior set completeopt=fuzzy,menu call setline(1, ['hello help hero h']) - exe "norm! A\\" + " Use "!" flag of feedkeys() so that ex_normal_busy is not set and + " ins_compl_check_keys() is not skipped. + " Add a "0" after the to avoid waiting for an escape sequence. + call feedkeys("A\\\0", 'tx!') call assert_equal('hello help hero hello', getline('.')) set completeopt+=noinsert call setline(1, ['hello help hero h']) - exe "norm! A\\" + call feedkeys("A\\\0", 'tx!') call assert_equal('hello help hero h', getline('.')) " clean up -- cgit From 191a70f9dd347926bc74a9928fce388be0000248 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 16 Jun 2024 11:27:20 +0200 Subject: vim-patch:9.1.0492: filetype: Vim-script files not detected by shebang line Problem: Vim-script files may not be recognised Solution: Add shebang line detection (Doug Kearns) closes: vim/vim#15012 https://github.com/vim/vim/commit/0d4d23dac0a5a77ccb0ebf1dcf646afe0c6886bf Co-authored-by: Doug Kearns --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 8bbda1dc99..ec9d88d3bf 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -992,6 +992,7 @@ func s:GetScriptChecks() abort \ ['#!/path/regina']], \ 'janet': [['#!/path/janet']], \ 'dart': [['#!/path/dart']], + \ 'vim': [['#!/path/vim']], \ } endfunc -- cgit From 20a7eebec086129e605041d32916f36df50890de Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 17 Jun 2024 06:42:11 +0800 Subject: vim-patch:9.1.0494: Wrong matched text highlighted in pum with 'rightleft' (#29371) Problem: Wrong matched text highlighted in pum with 'rightleft'. Solution: Match using the original text instead of the reversed text. (zeertzjq) closes: vim/vim#15020 https://github.com/vim/vim/commit/63901e89638d683ecbc8e3323170dd485657fd1d --- test/old/testdir/test_popup.vim | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index b6b8b44f82..6c14fb3a6e 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1397,6 +1397,7 @@ func Test_pum_highlights_match() return { \ 'words': [ \ { 'word': 'foo', 'kind': 'fookind' }, + \ { 'word': 'foofoo', 'kind': 'fookind' }, \ { 'word': 'foobar', 'kind': 'fookind' }, \ { 'word': 'fooBaz', 'kind': 'fookind' }, \ { 'word': 'foobala', 'kind': 'fookind' }, @@ -1408,7 +1409,7 @@ func Test_pum_highlights_match() endfunc set omnifunc=Omni_test set completeopt=menu,noinsert,fuzzy - hi PmenuMatchSel ctermfg=6 ctermbg=225 + hi PmenuMatchSel ctermfg=6 ctermbg=7 hi PmenuMatch ctermfg=4 ctermbg=225 END call writefile(lines, 'Xscript', 'D') @@ -1419,7 +1420,7 @@ func Test_pum_highlights_match() call term_sendkeys(buf, "fo") call TermWait(buf, 50) call VerifyScreenDump(buf, 'Test_pum_highlights_03', {}) - call term_sendkeys(buf, "\S\\") + call term_sendkeys(buf, "\S\\") call TermWait(buf, 50) call term_sendkeys(buf, "你") call TermWait(buf, 50) @@ -1427,28 +1428,48 @@ func Test_pum_highlights_match() call term_sendkeys(buf, "吗") call TermWait(buf, 50) call VerifyScreenDump(buf, 'Test_pum_highlights_05', {}) + call term_sendkeys(buf, "\\") if has('rightleft') - call term_sendkeys(buf, "\\u:set rightleft\") + call term_sendkeys(buf, ":set rightleft\") call TermWait(buf, 50) - call term_sendkeys(buf, "i\\") + call term_sendkeys(buf, "S\\") call TermWait(buf, 50) call term_sendkeys(buf, "fo") call TermWait(buf, 50) call VerifyScreenDump(buf, 'Test_pum_highlights_06', {}) - call term_sendkeys(buf, "\\u:set norightleft\") + call term_sendkeys(buf, "\S\\") + call TermWait(buf, 50) + call term_sendkeys(buf, "你") + call VerifyScreenDump(buf, 'Test_pum_highlights_06a', {}) + call term_sendkeys(buf, "吗") + call VerifyScreenDump(buf, 'Test_pum_highlights_06b', {}) + call term_sendkeys(buf, "\\") + call term_sendkeys(buf, ":set norightleft\") call TermWait(buf) endif call term_sendkeys(buf, ":set completeopt-=fuzzy\") call TermWait(buf) - call term_sendkeys(buf, "\S\\") + call term_sendkeys(buf, "S\\") call TermWait(buf, 50) call term_sendkeys(buf, "fo") call TermWait(buf, 50) call VerifyScreenDump(buf, 'Test_pum_highlights_07', {}) + call term_sendkeys(buf, "\\") + + if has('rightleft') + call term_sendkeys(buf, ":set rightleft\") + call TermWait(buf, 50) + call term_sendkeys(buf, "S\\") + call TermWait(buf, 50) + call term_sendkeys(buf, "fo") + call TermWait(buf, 50) + call VerifyScreenDump(buf, 'Test_pum_highlights_08', {}) + call term_sendkeys(buf, "\\") + call term_sendkeys(buf, ":set norightleft\") + endif - call term_sendkeys(buf, "\\u") call TermWait(buf) call StopVimInTerminal(buf) endfunc -- cgit From c429c5f86fb8286bbb28e96985d9cc212155201b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 18 Jun 2024 05:49:33 +0800 Subject: vim-patch:9.1.0495: Matched text isn't highlighted in cmdline pum Problem: Matched text isn't highlighted in cmdline pum. Solution: Use cmdline completion pattern in cmdline mode. (zeertzjq) closes: vim/vim#15029 https://github.com/vim/vim/commit/d8c9340fc67ca19f82ec3e77ec38296424e758cf Cherry-pick syntax.txt change from runtime update. --- test/old/testdir/test_cmdline.vim | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index f83f782817..4a637552a6 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -2923,6 +2923,37 @@ func Test_wildmenu_pum_rightleft() call StopVimInTerminal(buf) endfunc +" Test highlighting matched text in cmdline completion popup menu. +func Test_wildmenu_pum_hl_match() + CheckScreendump + + let lines =<< trim END + set wildoptions=pum,fuzzy + hi PmenuMatchSel ctermfg=6 ctermbg=7 + hi PmenuMatch ctermfg=4 ctermbg=225 + END + call writefile(lines, 'Xwildmenu_pum_hl', 'D') + let buf = RunVimInTerminal('-S Xwildmenu_pum_hl', #{rows: 10, cols: 50}) + + call term_sendkeys(buf, ":sign plc\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_1', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_2', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_3', {}) + call term_sendkeys(buf, "\:set wildoptions-=fuzzy\") + call TermWait(buf) + call term_sendkeys(buf, ":sign un\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_4', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_5', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_hl_match_6', {}) + call term_sendkeys(buf, "\") + + call StopVimInTerminal(buf) +endfunc + " Test for completion after a :substitute command followed by a pipe (|) " character func Test_cmdline_complete_substitute() -- cgit From c2491fbab43fc506f7f902c72206d890e01688a5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 18 Jun 2024 06:02:01 +0800 Subject: vim-patch:9.1.0496: matched text is highlighted case-sensitively Problem: matched text is highlighted case-sensitively Solution: use MB_STRNICMP, update highlighting when the base changes (glepnir) fixes: vim/vim#15021 closes: vim/vim#15023 https://github.com/vim/vim/commit/f189138b39a11ed5cf3adea6610469b478841aba Co-authored-by: glepnir --- test/old/testdir/test_popup.vim | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 6c14fb3a6e..bfd81ad0a9 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1407,6 +1407,20 @@ func Test_pum_highlights_match() \ { 'word': '你可好吗' }, \]} endfunc + + func Comp() + let col = col('.') + if getline('.') == 'f' + let col -= 1 + endif + call complete(col, [ + \ #{word: "foo", icase: 1}, + \ #{word: "Foobar", icase: 1}, + \ #{word: "fooBaz", icase: 1}, + \]) + return '' + endfunc + set omnifunc=Omni_test set completeopt=menu,noinsert,fuzzy hi PmenuMatchSel ctermfg=6 ctermbg=7 @@ -1470,7 +1484,14 @@ func Test_pum_highlights_match() call term_sendkeys(buf, ":set norightleft\") endif + call term_sendkeys(buf, "S\=Comp()\f") + call VerifyScreenDump(buf, 'Test_pum_highlights_09', {}) + call term_sendkeys(buf, "o\\=Comp()\") + call VerifyScreenDump(buf, 'Test_pum_highlights_09', {}) + + call term_sendkeys(buf, "\\") call TermWait(buf) + call StopVimInTerminal(buf) endfunc -- cgit From 4e8ec4900eb9fdc2a864e65d3de73c51e963abd0 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 19 Jun 2024 05:47:25 +0800 Subject: vim-patch:9.1.0498: getcmdcompltype() interferes with cmdline completion (#29397) Problem: getcmdcompltype() interferes with cmdline completion. Solution: Don't set expand context when it's already set. (zeertzjq) closes: vim/vim#15036 https://github.com/vim/vim/commit/a821b609f9bb9daef032fe1cb8fb95995822e367 --- test/old/testdir/test_cmdline.vim | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index 4a637552a6..24811d49db 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -3785,7 +3785,7 @@ func Test_cmdline_complete_bang_cmd_argument() endfunc func Call_cmd_funcs() - return string([getcmdpos(), getcmdscreenpos(), getcmdcompltype()]) + return [getcmdpos(), getcmdscreenpos(), getcmdcompltype()] endfunc func Test_screenpos_and_completion() @@ -3793,13 +3793,24 @@ func Test_screenpos_and_completion() call assert_equal(0, getcmdscreenpos()) call assert_equal('', getcmdcompltype()) - cnoremap string([getcmdpos(), getcmdscreenpos(), getcmdcompltype()]) + cnoremap string(Call_cmd_funcs()) call feedkeys(":let a\\\"\", "xt") call assert_equal("\"let a[6, 7, 'var']", @:) call feedkeys(":quit \\\"\", "xt") call assert_equal("\"quit [6, 7, '']", @:) call feedkeys(":nosuchcommand \\\"\", "xt") call assert_equal("\"nosuchcommand [15, 16, '']", @:) + + " Check that getcmdcompltype() doesn't interfere with cmdline completion. + let g:results = [] + cnoremap let g:results += [[getcmdline()] + Call_cmd_funcs()] + call feedkeys(":sign un\\\\\\\", "xt") + call assert_equal([ + \ ['sign undefine', 14, 15, 'sign'], + \ ['sign unplace', 13, 14, 'sign'], + \ ['sign un', 8, 9, 'sign']], g:results) + + unlet g:results cunmap endfunc -- cgit From a2d510e1015d57f28ab20c5d2897527cae15b9c4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 19 Jun 2024 06:32:02 +0800 Subject: vim-patch:9.1.0499: MS-Windows: doesn't handle symlinks properly (#29400) Problem: MS-Windows: doesn't handle symlinks properly (Timothy Madden) Solution: Implement lstat() on MS-Windows (author) lstat() differs from stat() in how it handles symbolic links, the former doesn't resolve the symlink while the latter does so. Implement a simple yet effective fallback using Win32 APIs. fixes vim/vim#14933 closes: vim/vim#15014 https://github.com/vim/vim/commit/23c5ebeb95cb942df307946e3ced230a7c8312eb Co-authored-by: LemonBoy Co-authored-by: K.Takata --- test/old/testdir/test_functions.vim | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 81e843ba8d..3faa720850 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -3475,6 +3475,29 @@ func Test_glob2() endif endfunc +func Test_glob_symlinks() + call writefile([], 'Xglob1') + + if has("win32") + silent !mklink XglobBad DoesNotExist + if v:shell_error + throw 'Skipped: cannot create symlinks' + endif + silent !mklink XglobOk Xglob1 + else + silent !ln -s DoesNotExist XglobBad + silent !ln -s Xglob1 XglobOk + endif + + " The broken symlink is excluded when alllinks is false. + call assert_equal(['Xglob1', 'XglobBad', 'XglobOk'], sort(glob('Xglob*', 0, 1, 1))) + call assert_equal(['Xglob1', 'XglobOk'], sort(glob('Xglob*', 0, 1, 0))) + + call delete('Xglob1') + call delete('XglobBad') + call delete('XglobOk') +endfunc + " Test for browse() func Test_browse() CheckFeature browse -- cgit From a2a3e8412e6d4e9a952c57a5298016cae8bf5229 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 19 Jun 2024 07:42:56 +0800 Subject: vim-patch:8.2.5047: CurSearch highlight is often wrong Problem: CurSearch highlight is often wrong. Solution: Remember the last highlighted position and redraw when needed. https://github.com/vim/vim/commit/368137aa525982984beed73940af481ac53a62af Co-authored-by: Bram Moolenaar --- test/old/testdir/test_search.vim | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_search.vim b/test/old/testdir/test_search.vim index 018ee7ad5a..8b535b5b19 100644 --- a/test/old/testdir/test_search.vim +++ b/test/old/testdir/test_search.vim @@ -1094,6 +1094,11 @@ func Test_hlsearch_cursearch() call term_sendkeys(buf, "h\") call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_multiple_line_5', {}) + " check clearing CurSearch when using it for another match + call term_sendkeys(buf, "G?^abcd\Y") + call term_sendkeys(buf, "kkP") + call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_changed_1', {}) + call StopVimInTerminal(buf) call delete('Xhlsearch_cursearch') endfunc -- cgit From b48192af37aa39d55e73420e3838cb63f471da99 Mon Sep 17 00:00:00 2001 From: Yinzuo Jiang Date: Wed, 19 Jun 2024 21:23:21 +0800 Subject: vim-patch:partial:9.1.0497: termdebug can be further improved Problem: termdebug can be further improved Solution: refactor save/restore, update docs, add a new save/restore test (Ubaldo Tiberi) closes: vim/vim#15032 https://github.com/vim/vim/commit/a48637c105ce5ccf6f3296958c889d15dc3faaa4 Co-authored-by: Ubaldo Tiberi --- test/old/testdir/test_termdebug.vim | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_termdebug.vim b/test/old/testdir/test_termdebug.vim index 38278cb326..c84478fefa 100644 --- a/test/old/testdir/test_termdebug.vim +++ b/test/old/testdir/test_termdebug.vim @@ -341,14 +341,41 @@ func Test_termdebug_bufnames() endfunc function Test_termdebug_save_restore_variables() + " saved mousemodel let &mousemodel='' + + " saved keys + nnoremap K :echo "hello world!" + let expected_map_K = maparg('K', 'n', 0 , 1) + nnoremap + :echo "hello plus!" + let expected_map_plus = maparg('+', 'n', 0 , 1) + let expected_map_minus = {} + + " saved &columns + let expected_columns = &columns + + " We want termdebug to overwrite 'K' map but not '+' map. + let g:termdebug_config = {} + let g:termdebug_config['map_K'] = 1 + Termdebug call WaitForAssert({-> assert_equal(3, winnr('$'))}) call WaitForAssert({-> assert_match(&mousemodel, 'popup_setpos')}) wincmd t quit! call WaitForAssert({-> assert_equal(1, winnr('$'))}) - call WaitForAssert({-> assert_true(empty(&mousemodel))}) + + call assert_true(empty(&mousemodel)) + + call assert_true(empty(expected_map_minus)) + call assert_equal(expected_map_K.rhs, maparg('K', 'n', 0, 1).rhs) + call assert_equal(expected_map_plus.rhs, maparg('+', 'n', 0, 1).rhs) + + call assert_equal(expected_columns, &columns) + + nunmap K + nunmap + + unlet g:termdebug_config endfunction -- cgit From 3317aa2f3756d21905b501a01d4f2b3203f60943 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 20 Jun 2024 09:57:00 +0800 Subject: vim-patch:9.1.0504: inner-tag textobject confused about ">" in attributes (#29420) Problem: inner-tag textobject confused about ">" in attributes Solution: Skip over quoted '>' when determining the start position fixes: vim/vim#15043 closes: vim/vim#15049 https://github.com/vim/vim/commit/ca7f93e6f351b310c17cfc8f88acf21c839d6116 Co-authored-by: Christian Brabandt --- test/old/testdir/test_textobjects.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_textobjects.vim b/test/old/testdir/test_textobjects.vim index a7840860c9..0f41f0a241 100644 --- a/test/old/testdir/test_textobjects.vim +++ b/test/old/testdir/test_textobjects.vim @@ -203,6 +203,18 @@ func Test_string_html_objects() normal! 2k0vaty call assert_equal("
", @", e) + " tag, that includes a > in some attribute + let t = "
> foo >> bar \">Hello
" + $put =t + normal! fHyit + call assert_equal("Hello", @", e) + + " tag, that includes a > in some attribute + let t = "
Hello 123
" + $put =t + normal! fHyit + call assert_equal("Hello 123", @", e) + set quoteescape& " this was going beyond the end of the line -- cgit From 99373c8792d1338ea011bf8efc708bb434530d05 Mon Sep 17 00:00:00 2001 From: Yinzuo Jiang Date: Thu, 20 Jun 2024 10:44:11 +0800 Subject: vim-patch:partial:9.1.0501: too complicated mapping restore in termdebug Problem: too complicated mapping restore in termdebug Solution: simplify unmapping logic, add a few more tests (Ubaldo Tiberi) closes: vim/vim#15046 https://github.com/vim/vim/commit/46f2823807741ac91c51cf36ddabf293db26ab41 Co-authored-by: Ubaldo Tiberi --- test/old/testdir/test_termdebug.vim | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_termdebug.vim b/test/old/testdir/test_termdebug.vim index c84478fefa..bb107161eb 100644 --- a/test/old/testdir/test_termdebug.vim +++ b/test/old/testdir/test_termdebug.vim @@ -280,9 +280,20 @@ func Test_termdebug_mapping() call assert_equal(':echom "K"', maparg('K', 'n', 0, 1).rhs) %bw! + + " -- Test that local-buffer mappings are restored in the correct buffers -- + " local mappings for foo + file foo nnoremap K :echom "bK" nnoremap - :echom "b-" nnoremap + :echom "b+" + + " no mappings for 'bar' + enew + file bar + + " Start termdebug from foo + buffer foo Termdebug call WaitForAssert({-> assert_equal(3, winnr('$'))}) wincmd b @@ -290,15 +301,41 @@ func Test_termdebug_mapping() call assert_true(maparg('-', 'n', 0, 1).buffer) call assert_true(maparg('+', 'n', 0, 1).buffer) call assert_equal(maparg('K', 'n', 0, 1).rhs, ':echom "bK"') + + Source + buffer bar + call assert_false(maparg('K', 'n', 0, 1)->empty()) + call assert_false(maparg('-', 'n', 0, 1)->empty()) + call assert_false(maparg('+', 'n', 0, 1)->empty()) + call assert_true(maparg('K', 'n', 0, 1).buffer->empty()) + call assert_true(maparg('-', 'n', 0, 1).buffer->empty()) + call assert_true(maparg('+', 'n', 0, 1).buffer->empty()) wincmd t quit! redraw! call WaitForAssert({-> assert_equal(1, winnr('$'))}) + + " Termdebug session ended. Buffer 'bar' shall have no mappings + call assert_true(bufname() ==# 'bar') + call assert_false(maparg('K', 'n', 0, 1)->empty()) + call assert_false(maparg('-', 'n', 0, 1)->empty()) + call assert_false(maparg('+', 'n', 0, 1)->empty()) + call assert_true(maparg('K', 'n', 0, 1).buffer->empty()) + call assert_true(maparg('-', 'n', 0, 1).buffer->empty()) + call assert_true(maparg('+', 'n', 0, 1).buffer->empty()) + + " Buffer 'foo' shall have the same mapping as before running the termdebug + " session + buffer foo + call assert_true(bufname() ==# 'foo') call assert_true(maparg('K', 'n', 0, 1).buffer) call assert_true(maparg('-', 'n', 0, 1).buffer) call assert_true(maparg('+', 'n', 0, 1).buffer) call assert_equal(':echom "bK"', maparg('K', 'n', 0, 1).rhs) + nunmap K + nunmap + + nunmap - %bw! endfunc -- cgit From af0021f990bfd9681e8889ef217d26a89fadf5f0 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 20 Jun 2024 17:45:41 +0800 Subject: vim-patch:9.1.0505: filetype: Faust files are not recognized (#29426) Problem: filetype: Faust files are not recognized Solution: Detect '*.lib' files as Faust filetype, add detection for '*.dsp' files (Faust or Make), remove '*.lib' from Cobol filetype (PowerUser64) closes: vim/vim#14894 https://github.com/vim/vim/commit/aa61b8a9087e9cd999ef07e0d87b60f43d68f2c6 Co-authored-by: PowerUser64 --- test/old/testdir/test_filetype.vim | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index ec9d88d3bf..5d9e5a8a27 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -161,7 +161,7 @@ func s:GetFilenameChecks() abort \ 'cmakecache': ['CMakeCache.txt'], \ 'cmod': ['file.cmod'], \ 'cmusrc': ['any/.cmus/autosave', 'any/.cmus/rc', 'any/.cmus/command-history', 'any/.cmus/file.theme', 'any/cmus/rc', 'any/cmus/file.theme', '/.cmus/autosave', '/.cmus/command-history', '/.cmus/file.theme', '/.cmus/rc', '/cmus/file.theme', '/cmus/rc'], - \ 'cobol': ['file.cbl', 'file.cob', 'file.lib'], + \ 'cobol': ['file.cbl', 'file.cob'], \ 'coco': ['file.atg'], \ 'conaryrecipe': ['file.recipe'], \ 'conf': ['auto.master', 'file.conf', 'texdoc.cnf', '.x11vncrc', '.chktexrc', '.ripgreprc', 'ripgreprc', 'file.ctags', '.mbsyncrc'], @@ -257,6 +257,7 @@ func s:GetFilenameChecks() abort \ 'factor': ['file.factor'], \ 'falcon': ['file.fal'], \ 'fan': ['file.fan', 'file.fwt'], + \ 'faust': ['file.dsp', 'file.lib'], \ 'fennel': ['file.fnl'], \ 'fetchmail': ['.fetchmailrc'], \ 'fgl': ['file.4gl', 'file.4gh', 'file.m4gl'], @@ -421,7 +422,7 @@ func s:GetFilenameChecks() abort \ 'mail': ['snd.123', '.letter', '.letter.123', '.followup', '.article', '.article.123', 'pico.123', 'mutt-xx-xxx', 'muttng-xx-xxx', 'ae123.txt', 'file.eml', 'reportbug-file'], \ 'mailaliases': ['/etc/mail/aliases', '/etc/aliases', 'any/etc/aliases', 'any/etc/mail/aliases'], \ 'mailcap': ['.mailcap', 'mailcap'], - \ 'make': ['file.mk', 'file.mak', 'file.dsp', 'makefile', 'Makefile', 'makefile-file', 'Makefile-file', 'some-makefile', 'some-Makefile', 'Kbuild'], + \ 'make': ['file.mk', 'file.mak', 'makefile', 'Makefile', 'makefile-file', 'Makefile-file', 'some-makefile', 'some-Makefile', 'Kbuild'], \ 'mallard': ['file.page'], "\ 'man': ['file.man'], \ 'manconf': ['/etc/man.conf', 'man.config', 'any/etc/man.conf'], @@ -2399,6 +2400,32 @@ func Test_typ_file() filetype off endfunc +func Test_dsp_file() + filetype on + + " Microsoft Developer Studio Project file + + call writefile(['# Microsoft Developer Studio Project File'], 'Xfile.dsp', 'D') + split Xfile.dsp + call assert_equal('make', &filetype) + bwipe! + + let g:filetype_dsp = 'make' + split test.dsp + call assert_equal('make', &filetype) + bwipe! + unlet g:filetype_dsp + + " Faust + + call writefile(['this is a fallback'], 'Xfile.dsp') + split Xfile.dsp + call assert_equal('faust', &filetype) + bwipe! + + filetype off +endfunc + func Test_vba_file() filetype on -- cgit From 86ea42ce265a5a9df2843b04e8036268593825b9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 21 Jun 2024 06:29:13 +0800 Subject: vim-patch:9.1.0507: hard to detect cursor movement in the command line Problem: hard to detect cursor movement in the command line Solution: Add the CursorMovedC autocommand (Shougo Matsushita) closes: vim/vim#15040 https://github.com/vim/vim/commit/d09521476f41dd8dbddb25b7acd0b299f9bf94d3 Co-authored-by: Shougo Matsushita --- test/old/testdir/test_autocmd.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim index cdcd68f3d6..9132e0fdce 100644 --- a/test/old/testdir/test_autocmd.vim +++ b/test/old/testdir/test_autocmd.vim @@ -2010,6 +2010,21 @@ func Test_Cmdline() au! CmdlineEnter au! CmdlineLeave let &shellslash = save_shellslash + + au! CursorMovedC : let g:pos = getcmdpos() + let g:pos = 0 + call feedkeys(":hello\\", 'xt') + call assert_equal(5, g:pos) + call feedkeys(":12345678\=setcmdpos(3)\\", 'xt') + call assert_equal(3, g:pos) + au! CursorMovedC + + " CursorMovedC changes the cursor position. + au! CursorMovedC : let g:pos = getcmdpos() | call setcmdpos(getcmdpos()-1) + let g:pos = 0 + call feedkeys(":hello\\", 'xt') + call assert_equal(5, g:pos) + au! CursorMovedC endfunc " Test for BufWritePre autocommand that deletes or unloads the buffer. -- cgit From f45403db19d888266d1cc04756bfef20a26f9f7f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 21 Jun 2024 14:11:05 +0800 Subject: vim-patch:9.1.0511: CursorMovedC triggered wrongly with setcmdpos() Problem: CursorMovedC triggered wrongly with setcmdpos() (after v9.1.0507) Solution: Remove the premature triggering. Also don't trigger when cursor didn't move. (zeertzjq) closes: vim/vim#15064 https://github.com/vim/vim/commit/bc6f96708e3678dbb27ec4192d87cf94a15d4e9a --- test/old/testdir/test_autocmd.vim | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim index 9132e0fdce..3871cb5672 100644 --- a/test/old/testdir/test_autocmd.vim +++ b/test/old/testdir/test_autocmd.vim @@ -2011,20 +2011,28 @@ func Test_Cmdline() au! CmdlineLeave let &shellslash = save_shellslash - au! CursorMovedC : let g:pos = getcmdpos() - let g:pos = 0 - call feedkeys(":hello\\", 'xt') - call assert_equal(5, g:pos) - call feedkeys(":12345678\=setcmdpos(3)\\", 'xt') - call assert_equal(3, g:pos) + au! CursorMovedC : let g:pos += [getcmdpos()] + let g:pos = [] + call feedkeys(":hello\\=''\\\\", 'xt') + call assert_equal([5, 4, 5], g:pos) + let g:pos = [] + call feedkeys(":12345678\=setcmdpos(3)??''\\", 'xt') + call assert_equal([3], g:pos) + let g:pos = [] + call feedkeys(":12345678\=setcmdpos(3)??''\\\", 'xt') + call assert_equal([3, 2], g:pos) au! CursorMovedC - " CursorMovedC changes the cursor position. - au! CursorMovedC : let g:pos = getcmdpos() | call setcmdpos(getcmdpos()-1) - let g:pos = 0 - call feedkeys(":hello\\", 'xt') - call assert_equal(5, g:pos) + " setcmdpos() is no-op inside an autocommand + au! CursorMovedC : let g:pos += [getcmdpos()] | call setcmdpos(1) + let g:pos = [] + call feedkeys(":hello\\\", 'xt') + call assert_equal([5, 4], g:pos) au! CursorMovedC + + unlet g:entered + unlet g:left + unlet g:pos endfunc " Test for BufWritePre autocommand that deletes or unloads the buffer. -- cgit From 1db1476fd98a161df112863dbc87334394083341 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 21 Jun 2024 14:40:28 +0800 Subject: vim-patch:9.1.0512: Mode message for spell completion doesn't match allowed keys (#29437) Problem: Mode message for spell completion doesn't match allowed keys (Kyle Kovacs) Solution: Show "^S" instead of "s". (zeertzjq) This matches the code in vim_is_ctrl_x_key(): case CTRL_X_SPELL: return (c == Ctrl_S || c == Ctrl_P || c == Ctrl_N); fixes: neovim/neovim#29431 closes: vim/vim#15065 https://github.com/vim/vim/commit/7002c055d560ae0b3bb1e24ad409390a5443daad --- test/old/testdir/test_spell.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_spell.vim b/test/old/testdir/test_spell.vim index a19b64a7de..d55a51e8eb 100644 --- a/test/old/testdir/test_spell.vim +++ b/test/old/testdir/test_spell.vim @@ -5,6 +5,7 @@ source check.vim CheckFeature spell source screendump.vim +source view_util.vim func TearDown() set nospell @@ -300,6 +301,20 @@ func Test_compl_with_CTRL_X_CTRL_K_using_spell() set spell& spelllang& dictionary& ignorecase& endfunc +func Test_compl_with_CTRL_X_s() + new + set spell spelllang=en_us showmode + inoremap let g:msg = Screenline(&lines) + + call feedkeys("STheatre\s\\\", 'tx') + call assert_equal(['Theater'], getline(1, '$')) + call assert_match('(^S^N^P)', g:msg) + + bwipe! + set spell& spelllang& showmode& + unlet g:msg +endfunc + func Test_spellrepall() new set spell -- cgit From d82efeccc7e89230ba6673da0fdf62c09fa38c17 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 21 Jun 2024 10:29:44 +0200 Subject: vim-patch:9.1.0506: filetype: .envrc & .prettierignore not recognized Problem: filetype: .envrc & .prettierignore not recognized Solution: Detect '.envrc' as shell and '.prettierignore' as gitignore filetype (Tyler Miller) Support ft detection for `.envrc` files used by direnv, and `.prettierignore` files used by prettier. closes: vim/vim#15053 resolves: neovim/neovim#29405 https://github.com/vim/vim/commit/49012cd8c2fb0452847e5d213b07aa8a978f4762 Co-authored-by: Tyler Miller --- test/old/testdir/test_filetype.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 5d9e5a8a27..da312ded8a 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -287,7 +287,7 @@ func s:GetFilenameChecks() abort \ 'gitattributes': ['file.git/info/attributes', '.gitattributes', '/.config/git/attributes', '/etc/gitattributes', '/usr/local/etc/gitattributes', 'some.git/info/attributes'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/attributes'), \ 'gitcommit': ['COMMIT_EDITMSG', 'MERGE_MSG', 'TAG_EDITMSG', 'NOTES_EDITMSG', 'EDIT_DESCRIPTION'], \ 'gitconfig': ['file.git/config', 'file.git/config.worktree', 'file.git/worktrees/x/config.worktree', '.gitconfig', '.gitmodules', 'file.git/modules//config', '/.config/git/config', '/etc/gitconfig', '/usr/local/etc/gitconfig', '/etc/gitconfig.d/file', 'any/etc/gitconfig.d/file', '/.gitconfig.d/file', 'any/.config/git/config', 'any/.gitconfig.d/file', 'some.git/config', 'some.git/modules/any/config'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/config'), - \ 'gitignore': ['file.git/info/exclude', '.gitignore', '/.config/git/ignore', 'some.git/info/exclude'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/ignore'), + \ 'gitignore': ['file.git/info/exclude', '.gitignore', '/.config/git/ignore', 'some.git/info/exclude'] + s:WhenConfigHome('$XDG_CONFIG_HOME/git/ignore') + ['.prettierignore'], \ 'gitolite': ['gitolite.conf', '/gitolite-admin/conf/file', 'any/gitolite-admin/conf/file'], \ 'gitrebase': ['git-rebase-todo'], \ 'gitsendemail': ['.gitsendemail.msg.xxxxxx'], @@ -647,7 +647,7 @@ func s:GetFilenameChecks() abort \ 'sh': ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', '.bash-aliases', '.bash_history', '.bash-history', \ '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD', 'APKBUILD', 'file.bash', '/usr/share/doc/bash-completion/filter.sh', \ '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', 'file.bats', '.ash_history', 'any/etc/neofetch/config.conf', '.xprofile', - \ 'user-dirs.defaults', 'user-dirs.dirs', 'makepkg.conf', '.makepkg.conf', 'file.mdd', 'file.cygport'], + \ 'user-dirs.defaults', 'user-dirs.dirs', 'makepkg.conf', '.makepkg.conf', 'file.mdd', 'file.cygport', '.env', '.envrc'], \ 'sieve': ['file.siv', 'file.sieve'], \ 'sil': ['file.sil'], \ 'simula': ['file.sim'], -- cgit From 9e436251de0329b1479365ff162d87ef18d6d14c Mon Sep 17 00:00:00 2001 From: Yinzuo Jiang Date: Tue, 25 Jun 2024 11:34:37 +0800 Subject: vim-patch:9.1.0516: need more tests for nested dicts and list comparison (#29481) Problem: need more tests for nested dicts and list comparison Solution: Add tests for comparing deeply nested List/Dict values (Yegappan Lakshmanan) closes: vim/vim#15081 https://github.com/vim/vim/commit/88bbdb04c2776ba69b8e5da58051fd94f8842b03 Co-authored-by: Yegappan Lakshmanan --- test/old/testdir/test_listdict.vim | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index 0adc3286f9..6c22dc0784 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -1447,4 +1447,53 @@ func Test_extendnew_leak() for i in range(100) | silent! call extendnew({}, {}, {}) | endfor endfunc +" Test for comparing deeply nested List/Dict values +func Test_deep_nested_listdict_compare() + let lines =<< trim END + func GetNestedList(sz) + let l = [] + let x = l + for i in range(a:sz) + let y = [1] + call add(x, y) + let x = y + endfor + return l + endfunc + + VAR l1 = GetNestedList(1000) + VAR l2 = GetNestedList(999) + call assert_false(l1 == l2) + + #" after 1000 nested items, the lists are considered to be equal + VAR l3 = GetNestedList(1001) + VAR l4 = GetNestedList(1002) + call assert_true(l3 == l4) + END + call CheckLegacyAndVim9Success(lines) + + let lines =<< trim END + func GetNestedDict(sz) + let d = {} + let x = d + for i in range(a:sz) + let y = {} + let x['a'] = y + let x = y + endfor + return d + endfunc + + VAR d1 = GetNestedDict(1000) + VAR d2 = GetNestedDict(999) + call assert_false(d1 == d2) + + #" after 1000 nested items, the Dicts are considered to be equal + VAR d3 = GetNestedDict(1001) + VAR d4 = GetNestedDict(1002) + call assert_true(d3 == d4) + END + call CheckLegacyAndVim9Success(lines) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From e7020306a19a5211c834966ec067fff3b981bdb9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 30 Jun 2024 06:40:31 +0800 Subject: feat(jumplist): allow opting out of removing unloaded buffers (#29347) Problem: Cannot opt out of removing unloaded buffers from the jumplist. Solution: Only enable that with "unload" flag in 'jumpoptions'. --- test/old/testdir/setup.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/setup.vim b/test/old/testdir/setup.vim index 8a5eeb3aab..2e4085ce03 100644 --- a/test/old/testdir/setup.vim +++ b/test/old/testdir/setup.vim @@ -13,6 +13,7 @@ if exists('s:did_load') set laststatus=1 set listchars=eol:$ set joinspaces + set jumpoptions= set mousemodel=extend set nohidden nosmarttab noautoindent noautoread noruler noshowcmd set nohlsearch noincsearch -- cgit From 6cbba2b48d604b5fdbd874d75c30c6c55449f33e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 5 Jul 2024 07:10:30 +0800 Subject: vim-patch:9.1.0529: silent! causes following try/catch to not work (#29567) Problem: silent! causes following try/catch to not work (Malcolm Rowe) Solution: consider emsg_silent in handle_did_throw() and do not abort evaluation flow for :silent! (LemonBoy) The silent! flag causes the evaluation not to be aborted in case of uncaught exceptions, adjust handle_did_throw to take this detail into account. Fixes the long-standing todo.txt item: ``` Problem that a previous silent ":throw" causes a following try/catch not to work. (ZyX, 2013 Sep 28) With examples: (Malcolm Rowe, 2015 Dec 24) Also see vim/vim#8487 for an example. ``` fixes: vim/vim#538 closes: vim/vim#15128 https://github.com/vim/vim/commit/749ba0f6d922b3f6b54a66543c214479492b5a0e Cherry-pick Test_deeply_nested_source() from patch 8.2.5169. Co-authored-by: LemonBoy --- test/old/testdir/test_vimscript.vim | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_vimscript.vim b/test/old/testdir/test_vimscript.vim index 6ce59e1a2e..1012aca54d 100644 --- a/test/old/testdir/test_vimscript.vim +++ b/test/old/testdir/test_vimscript.vim @@ -7437,6 +7437,49 @@ func Test_for_over_string() call assert_equal('', res) endfunc +" Test for deeply nested :source command {{{1 +func Test_deeply_nested_source() + throw 'Skipped: Vim9 script is N/A' + let lines =<< trim END + + so + sil 0scr + delete + so + 0 + END + call writefile(["vim9 silent! @0 \n/"] + lines, 'Xnested.vim', 'D') + + " this must not crash + let cmd = GetVimCommand() .. " -e -s -S Xnested.vim -c qa!" + call system(cmd) +endfunc + +func Test_exception_silent() + XpathINIT + let lines =<< trim END + func Throw() + Xpath 'a' + throw "Uncaught" + " This line is not executed. + Xpath 'b' + endfunc + " The exception is suppressed due to the presence of silent!. + silent! call Throw() + try + call DoesNotExist() + catch /E117:/ + Xpath 'c' + endtry + Xpath 'd' + END + let verify =<< trim END + call assert_equal('acd', g:Xpath) + END + + call RunInNewVim(lines, verify) +endfunc + "------------------------------------------------------------------------------- " Modelines {{{1 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker -- cgit From 842725eedc1fce7ec1f4ab593215589b3029d6ae Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 5 Jul 2024 07:46:01 +0800 Subject: vim-patch:9.1.0525: Right release selects immediately when pum is truncated. (#29568) Problem: Right release selects immediately when pum is truncated. Solution: Use pum_height instead of pum_size when checking click row. Don't place it above mouse row when there is more space below. (zeertzjq) fixes: vim/vim#15101 closes: vim/vim#15102 https://github.com/vim/vim/commit/761a420c66402545acd8ee3ffa17c3a1fc3110e4 --- test/old/testdir/test_menu.vim | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_menu.vim b/test/old/testdir/test_menu.vim index d1c1180ce1..88d74c8a1a 100644 --- a/test/old/testdir/test_menu.vim +++ b/test/old/testdir/test_menu.vim @@ -482,13 +482,48 @@ func Test_popup_menu() unmenu PopUp endfunc +func Test_popup_menu_truncated() + CheckNotGui + + set mouse=a mousemodel=popup + aunmenu PopUp + for i in range(2 * &lines) + exe $'menu PopUp.{i} let g:res = {i}' + endfor + + func LeftClickExpr(row, col) + call Ntest_setmouse(a:row, a:col) + return "\" + endfunc + + " Clicking at the bottom should place popup menu above click position. + " should not select an item immediately. + let g:res = -1 + call Ntest_setmouse(&lines, 1) + nnoremap LeftClickExpr(4, 1) + call feedkeys("\\\", 'tx') + call assert_equal(3, g:res) + + " Clicking at the top should place popup menu below click position. + let g:res = -1 + call Ntest_setmouse(1, 1) + nnoremap LeftClickExpr(5, 1) + call feedkeys("\\\", 'tx') + call assert_equal(3, g:res) + + nunmap + delfunc LeftClickExpr + unlet g:res + aunmenu PopUp + set mouse& mousemodel& +endfunc + " Test for MenuPopup autocommand func Test_autocmd_MenuPopup() CheckNotGui - set mouse=a - set mousemodel=popup - aunmenu * + set mouse=a mousemodel=popup + aunmenu PopUp autocmd MenuPopup * exe printf( \ 'anoremenu PopUp.Foo let g:res = ["%s", "%s"]', \ expand(''), expand('')) -- cgit From 3e6cec0befd41d37ee36cb4f602e84c58c5f0d27 Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Fri, 5 Jul 2024 01:51:34 +0200 Subject: vim-patch:9.1.0526: Unwanted cursor movement with pagescroll at start of buffer (#29569) Problem: Cursor is moved to bottom of window trying to pagescroll when already at the start of the buffer (Asheq Imran, after v9.1.0357) Solution: Don't move cursor when buffer content did not move. (Luuk van Baal) https://github.com/vim/vim/commit/8ccb89016e4b4b7f87acd1da78486c077350ceef --- test/old/testdir/test_normal.vim | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index 170b2cda53..6ebdfb1604 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -4267,6 +4267,9 @@ func Test_page_cursor_topbot() call assert_equal(18, line('.')) exe "norm! \\" call assert_equal(9, line('.')) + " Not when already at the start of the buffer. + exe "norm! ggj\" + call assert_equal(2, line('.')) bwipe! endfunc -- cgit From 2a883d9c597e70d25ffc53373731d05d18a89b91 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 5 Jul 2024 15:20:02 +0800 Subject: vim-patch:9.1.0524: the recursive parameter in the *_equal functions can be removed (#29572) Problem: the recursive parameter in the *_equal functions can be removed Solution: Remove the recursive parameter in dict_equal(), list_equal() object_equal and tv_equal(). Use a comparison of the static var recursive_cnt == 0 to determine whether or not tv_equal() has been called recursively (Yinzuo Jiang). closes: vim/vim#15070 https://github.com/vim/vim/commit/7ccd1a2e858dbb2ac7fb09971dfcbfad62baa677 Co-authored-by: Yinzuo Jiang --- test/old/testdir/test_listdict.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index 6c22dc0784..35d63c87d0 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -1055,6 +1055,19 @@ func Test_listdict_compare() call assert_fails('echo {} =~ {}', 'E736:') endfunc +func Test_recursive_listdict_compare() + let l1 = [0, 1] + let l1[0] = l1 + let l2 = [0, 1] + let l2[0] = l2 + call assert_true(l1 == l2) + let d1 = {0: 0, 1: 1} + let d1[0] = d1 + let d2 = {0: 0, 1: 1} + let d2[0] = d2 + call assert_true(d1 == d2) +endfunc + " compare complex recursively linked list and dict func Test_listdict_compare_complex() let lines =<< trim END -- cgit From 0abaccb2a795c40cd7f55b9a19fe6ecb765479e2 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 5 Jul 2024 21:39:51 +0200 Subject: vim-patch:9.1.0532: filetype: Cedar files not recognized Problem: filetype: Cedar files not recognized Solution: Detect '*.cedar' files as cedar filetype (Riley Bruins) References: https://github.com/cedar-policy closes: vim/vim#15148 https://github.com/vim/vim/commit/15addb24dd3b2645f5c04d2742ab5eb53444a3a0 Co-authored-by: Riley Bruins --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index da312ded8a..5675068c71 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -143,6 +143,7 @@ func s:GetFilenameChecks() abort \ 'cdl': ['file.cdl'], \ 'cdrdaoconf': ['/etc/cdrdao.conf', '/etc/defaults/cdrdao', '/etc/default/cdrdao', '.cdrdao', 'any/etc/cdrdao.conf', 'any/etc/default/cdrdao', 'any/etc/defaults/cdrdao'], \ 'cdrtoc': ['file.toc'], + \ 'cedar': ['file.cedar'], \ 'cf': ['file.cfm', 'file.cfi', 'file.cfc'], \ 'cfengine': ['cfengine.conf'], \ 'cfg': ['file.hgrc', 'filehgrc', 'hgrc', 'some-hgrc'], -- cgit From 7a54d707fa6f32822b241140b31a348ad5ad0e6b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 6 Jul 2024 22:44:37 +0800 Subject: vim-patch:9.1.0534: completion wrong with fuzzy when cycling back to original (#29588) Problem: completion wrong with fuzzy when cycling back to original (Quan Nguyen) Solution: reset show_match_ok when cp_score is zero (glepnir) fixes: vim/vim#15095 closes: vim/vim#15105 https://github.com/vim/vim/commit/65407ce1d2963e7a758af8fecdcbd67b9a90bdb9 Co-authored-by: glepnir --- test/old/testdir/test_popup.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index bfd81ad0a9..4960041452 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1489,6 +1489,17 @@ func Test_pum_highlights_match() call term_sendkeys(buf, "o\\=Comp()\") call VerifyScreenDump(buf, 'Test_pum_highlights_09', {}) + " issue #15095 wrong select + call term_sendkeys(buf, "\:set completeopt=fuzzy,menu\") + call TermWait(buf) + call term_sendkeys(buf, "S hello helio hero h\\") + call TermWait(buf, 50) + call VerifyScreenDump(buf, 'Test_pum_highlights_10', {}) + + call term_sendkeys(buf, "\S hello helio hero h\\\") + call TermWait(buf, 50) + call VerifyScreenDump(buf, 'Test_pum_highlights_11', {}) + call term_sendkeys(buf, "\\") call TermWait(buf) -- cgit From 5da9b49b19240bb00f338249fef84a2bf1212b49 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 7 Jul 2024 06:32:54 +0800 Subject: vim-patch:9.1.0537: signed number detection for CTRL-X/A can be improved (#29590) Problem: signed number detection for CTRL-X/A can be improved (Chris Patuzzo) Solution: Add the new "blank" value for the 'nrformat' setting. This will make Vim assume a signed number only if there is a blank in front of the sign. (distobs) fixes: vim/vim#15033 closes: vim/vim#15110 https://github.com/vim/vim/commit/25ac6d67d92e0adda53b8d44b81c15031643ca1e Co-authored-by: distobs --- test/old/testdir/test_increment.vim | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_increment.vim b/test/old/testdir/test_increment.vim index 433b2b4471..cf6334747a 100644 --- a/test/old/testdir/test_increment.vim +++ b/test/old/testdir/test_increment.vim @@ -841,6 +841,44 @@ func Test_increment_unsigned() set nrformats-=unsigned endfunc +" Try incrementing/decrementing a number when nrformats contains blank +func Test_increment_blank() + set nrformats+=blank + + " Signed + call setline(1, '0') + exec "norm! gg0\" + call assert_equal('-1', getline(1)) + + call setline(1, '3') + exec "norm! gg010\" + call assert_equal('-7', getline(1)) + + call setline(1, '-0') + exec "norm! gg0\" + call assert_equal("-1", getline(1)) + + " Unsigned + " NOTE: 18446744073709551615 == 2^64 - 1 + call setline(1, 'a-18446744073709551615') + exec "norm! gg0\" + call assert_equal('a-18446744073709551615', getline(1)) + + call setline(1, 'a-18446744073709551615') + exec "norm! gg0\" + call assert_equal('a-18446744073709551615', getline(1)) + + call setline(1, 'a-18446744073709551614') + exec "norm! gg08\" + call assert_equal('a-18446744073709551615', getline(1)) + + call setline(1, 'a-1') + exec "norm! gg0\" + call assert_equal('a-2', getline(1)) + + set nrformats-=blank +endfunc + func Test_in_decrement_large_number() " NOTE: 18446744073709551616 == 2^64 call setline(1, '18446744073709551616') -- cgit From 472b5b9b20756146db39cf32c6fb678e1d8104c0 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 6 Jul 2024 18:00:09 +0200 Subject: vim-patch:9.1.0536: filetype: zone files are not recognized Problem: filetype: zone files are not recognized (rpdprd) Solution: Detect '*.zone' files as bindzone filetype fixes: vim/vim#14222 https://github.com/vim/vim/commit/f095539b3900d76f5eeaaa0897c6abf970829b31 Co-authored-by: Christian Brabandt --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 5675068c71..8d2ea84a1b 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -122,7 +122,7 @@ func s:GetFilenameChecks() abort \ 'beancount': ['file.beancount'], \ 'bib': ['file.bib'], \ 'bicep': ['file.bicep', 'file.bicepparam'], - \ 'bindzone': ['named.root', '/bind/db.file', '/named/db.file', 'any/bind/db.file', 'any/named/db.file'], + \ 'bindzone': ['named.root', '/bind/db.file', '/named/db.file', 'any/bind/db.file', 'any/named/db.file', 'foobar.zone'], \ 'bitbake': ['file.bb', 'file.bbappend', 'file.bbclass', 'build/conf/local.conf', 'meta/conf/layer.conf', 'build/conf/bbappend.conf', 'meta-layer/conf/distro/foo.conf'], \ 'blade': ['file.blade.php'], \ 'blank': ['file.bl'], -- cgit From 6a886a2511bbfd24a4d6ecc3f3a75f08a6df9de9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 7 Jul 2024 07:21:14 +0800 Subject: vim-patch:9.1.0538: not possible to assign priority when defining a sign (#29592) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: not possible to assign priority when defining a sign (Mathias Fußenegger) Solution: Add the priority argument for the :sign-define ex command and the sign_define() function (LemonBoy) Use the specified value instead of the default one (SIGN_DEF_PRIO) when no priority is explicitly specified in sign_place or :sign place. fixes: vim/vim#8334 closes: vim/vim#15124 https://github.com/vim/vim/commit/b975ddfdf96644b8df808415dee36f99abd48753 Co-authored-by: LemonBoy --- test/old/testdir/test_signs.vim | 46 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_signs.vim b/test/old/testdir/test_signs.vim index 69fefccb3f..baeaeb0f3d 100644 --- a/test/old/testdir/test_signs.vim +++ b/test/old/testdir/test_signs.vim @@ -246,7 +246,7 @@ func Test_sign_completion() call assert_equal('"sign define jump list place undefine unplace', @:) call feedkeys(":sign define Sign \\\"\", 'tx') - call assert_equal('"sign define Sign culhl= icon= linehl= numhl= text= texthl=', @:) + call assert_equal('"sign define Sign culhl= icon= linehl= numhl= priority= text= texthl=', @:) for hl in ['culhl', 'linehl', 'numhl', 'texthl'] call feedkeys(":sign define Sign "..hl.."=Spell\\\"\", 'tx') @@ -1240,9 +1240,28 @@ func Test_sign_priority() call sign_define("sign1", attr) call sign_define("sign2", attr) call sign_define("sign3", attr) + let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Search', 'priority': 60} + call sign_define("sign4", attr) + + " Test for :sign list + let a = execute('sign list') + call assert_equal("\nsign sign1 text==> linehl=Search texthl=Search\n" . + \ "sign sign2 text==> linehl=Search texthl=Search\n" . + \ "sign sign3 text==> linehl=Search texthl=Search\n" . + \ "sign sign4 text==> priority=60 linehl=Search texthl=Search", a) + + " Test for sign_getdefined() + let s = sign_getdefined() + call assert_equal([ + \ {'name': 'sign1', 'texthl': 'Search', 'linehl': 'Search', 'text': '=>'}, + \ {'name': 'sign2', 'texthl': 'Search', 'linehl': 'Search', 'text': '=>'}, + \ {'name': 'sign3', 'texthl': 'Search', 'linehl': 'Search', 'text': '=>'}, + \ {'name': 'sign4', 'priority': 60, 'texthl': 'Search', 'linehl': 'Search', + \ 'text': '=>'}], + \ s) " Place three signs with different priority in the same line - call writefile(repeat(["Sun is shining"], 30), "Xsign") + call writefile(repeat(["Sun is shining"], 30), "Xsign", 'D') edit Xsign call sign_place(1, 'g1', 'sign1', 'Xsign', @@ -1577,16 +1596,34 @@ func Test_sign_priority() call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . \ " line=10 id=5 group=g1 name=sign1 priority=20\n", a) + call sign_unplace('*') + + " Test for sign with default priority. + call sign_place(1, 'g1', 'sign4', 'Xsign', {'lnum' : 3}) + sign place 2 line=5 name=sign4 group=g1 file=Xsign + + let s = sign_getplaced('Xsign', {'group' : '*'}) + call assert_equal([ + \ {'id' : 1, 'name' : 'sign4', 'lnum' : 3, 'group' : 'g1', + \ 'priority' : 60}, + \ {'id' : 2, 'name' : 'sign4', 'lnum' : 5, 'group' : 'g1', + \ 'priority' : 60}], + \ s[0].signs) + + let a = execute('sign place group=g1') + call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . + \ " line=3 id=1 group=g1 name=sign4 priority=60\n" . + \ " line=5 id=2 group=g1 name=sign4 priority=60\n", a) + call sign_unplace('*') call sign_undefine() enew | only - call delete("Xsign") endfunc " Tests for memory allocation failures in sign functions func Test_sign_memfailures() CheckFunction test_alloc_fail - call writefile(repeat(["Sun is shining"], 30), "Xsign") + call writefile(repeat(["Sun is shining"], 30), "Xsign", 'D') edit Xsign call test_alloc_fail(GetAllocId('sign_getdefined'), 0, 0) @@ -1623,7 +1660,6 @@ func Test_sign_memfailures() call sign_unplace('*') call sign_undefine() enew | only - call delete("Xsign") endfunc " Test for auto-adjusting the line number of a placed sign. -- cgit From 76b91106fc836ae634cdf8425d121d843d14d70a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 8 Jul 2024 06:55:21 +0800 Subject: vim-patch:9.1.0543: Behavior of CursorMovedC is strange (#29608) Problem: Behavior of CursorMovedC is strange. Solution: Also trigger when the cmdline has changed. (zeertzjq) fixes: vim/vim#15069 closes: vim/vim#15071 https://github.com/vim/vim/commit/8145620a958dbb5c82cf8f8a37556ee1ea501c6d --- test/old/testdir/test_autocmd.vim | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim index 3871cb5672..862c48a1eb 100644 --- a/test/old/testdir/test_autocmd.vim +++ b/test/old/testdir/test_autocmd.vim @@ -2013,21 +2013,30 @@ func Test_Cmdline() au! CursorMovedC : let g:pos += [getcmdpos()] let g:pos = [] + call feedkeys(":foo bar baz\\\\", 'xt') + call assert_equal([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 9, 5, 1], g:pos) + let g:pos = [] + call feedkeys(":hello\\", 'xt') + call assert_equal([2, 3, 4, 5, 6, 1], g:pos) + let g:pos = [] + call feedkeys(":hello\\", 'xt') + call assert_equal([2, 3, 4, 5, 6, 1], g:pos) + let g:pos = [] call feedkeys(":hello\\=''\\\\", 'xt') - call assert_equal([5, 4, 5], g:pos) + call assert_equal([2, 3, 4, 5, 6, 5, 4, 5], g:pos) let g:pos = [] call feedkeys(":12345678\=setcmdpos(3)??''\\", 'xt') - call assert_equal([3], g:pos) + call assert_equal([2, 3, 4, 5, 6, 7, 8, 9, 3], g:pos) let g:pos = [] call feedkeys(":12345678\=setcmdpos(3)??''\\\", 'xt') - call assert_equal([3, 2], g:pos) + call assert_equal([2, 3, 4, 5, 6, 7, 8, 9, 3, 2], g:pos) au! CursorMovedC " setcmdpos() is no-op inside an autocommand au! CursorMovedC : let g:pos += [getcmdpos()] | call setcmdpos(1) let g:pos = [] call feedkeys(":hello\\\", 'xt') - call assert_equal([5, 4], g:pos) + call assert_equal([2, 3, 4, 5, 6, 5, 4], g:pos) au! CursorMovedC unlet g:entered -- cgit From bf92d423a9ac4bd3d30685c23a0d9a0dd772b7a7 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 8 Jul 2024 10:39:03 +0200 Subject: vim-patch:9.1.0544: filetype: ldapconf files are not recognized Problem: filetype: ldapconf files are not recognized Solution: Detect '.ldaprc', 'ldap.conf' and 'ldaprc' files as ldapconf filetype, include a simple ldapconf ftplugin file (Riley Bruins) [Specification](https://www.openldap.org/software//man.cgi?query=ldap.conf&sektion=5&apropos=0&manpath=OpenLDAP+2.4-Release) closes: vim/vim#15176 https://github.com/vim/vim/commit/62f31e949918167cb7f50cdf1737f7c28460b62b Co-authored-by: Riley Bruins --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 8d2ea84a1b..71e3074d51 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -386,6 +386,7 @@ func s:GetFilenameChecks() abort \ 'lace': ['file.ace', 'file.ACE'], \ 'latte': ['file.latte', 'file.lte'], \ 'ld': ['file.ld', 'any/usr/lib/aarch64-xilinx-linux/ldscripts/aarch64elf32b.x'], + \ 'ldapconf': ['ldap.conf', '.ldaprc', 'ldaprc'], \ 'ldif': ['file.ldif'], \ 'lean': ['file.lean'], \ 'ledger': ['file.ldg', 'file.ledger', 'file.journal'], -- cgit From 545aafbeb80eb52c182ce139800489b392a12d0d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 10 Jul 2024 08:07:16 +0800 Subject: vim-patch:9.1.0547: No way to get the arity of a Vim function (#29638) Problem: No way to get the arity of a Vim function (Austin Ziegler) Solution: Enhance get() Vim script function to return the function argument info using get(func, "arity") (LemonBoy) fixes: vim/vim#15097 closes: vim/vim#15109 https://github.com/vim/vim/commit/48b7d05a4f88c4326bd5d7a73a523f2d953b3e51 Co-authored-by: LemonBoy --- test/old/testdir/test_getvar.vim | 10 ++++++++++ test/old/testdir/test_partial.vim | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_getvar.vim b/test/old/testdir/test_getvar.vim index 1e29f49fb4..56f737ab9c 100644 --- a/test/old/testdir/test_getvar.vim +++ b/test/old/testdir/test_getvar.vim @@ -142,21 +142,31 @@ func Test_get_func() let l:F = function('tr') call assert_equal('tr', get(l:F, 'name')) call assert_equal(l:F, get(l:F, 'func')) + call assert_equal({'required': 3, 'optional': 0, 'varargs': v:false}, + \ get(l:F, 'arity')) let Fb_func = function('s:FooBar') call assert_match('\d\+_FooBar', get(Fb_func, 'name')) + call assert_equal({'required': 0, 'optional': 0, 'varargs': v:false}, + \ get(Fb_func, 'arity')) let Fb_ref = funcref('s:FooBar') call assert_match('\d\+_FooBar', get(Fb_ref, 'name')) + call assert_equal({'required': 0, 'optional': 0, 'varargs': v:false}, + \ get(Fb_ref, 'arity')) call assert_equal({'func has': 'no dict'}, get(l:F, 'dict', {'func has': 'no dict'})) call assert_equal(0, get(l:F, 'dict')) call assert_equal([], get(l:F, 'args')) + " Nvim doesn't have null functions " let NF = test_null_function() " call assert_equal('', get(NF, 'name')) " call assert_equal(NF, get(NF, 'func')) " call assert_equal(0, get(NF, 'dict')) " call assert_equal([], get(NF, 'args')) + " call assert_equal({'required': 0, 'optional': 0, 'varargs': v:false}, get(NF, 'arity')) endfunc " get({partial}, {what} [, {default}]) - in test_partial.vim + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_partial.vim b/test/old/testdir/test_partial.vim index 8b62e4a0e5..d049cc9e4b 100644 --- a/test/old/testdir/test_partial.vim +++ b/test/old/testdir/test_partial.vim @@ -284,6 +284,11 @@ func Test_auto_partial_rebind() endfunc func Test_get_partial_items() + func s:Qux(x, y, z=3, w=1, ...) + endfunc + func s:Qux1(x, y) + endfunc + let dict = {'name': 'hello'} let args = ["foo", "bar"] let Func = function('MyDictFunc') @@ -304,6 +309,23 @@ func Test_get_partial_items() let dict = {'partial has': 'no dict'} call assert_equal(dict, get(P, 'dict', dict)) call assert_equal(0, get(l:P, 'dict')) + + call assert_equal({'required': 2, 'optional': 2, 'varargs': v:true}, + \ get(funcref('s:Qux', []), 'arity')) + call assert_equal({'required': 1, 'optional': 2, 'varargs': v:true}, + \ get(funcref('s:Qux', [1]), 'arity')) + call assert_equal({'required': 0, 'optional': 2, 'varargs': v:true}, + \ get(funcref('s:Qux', [1, 2]), 'arity')) + call assert_equal({'required': 0, 'optional': 1, 'varargs': v:true}, + \ get(funcref('s:Qux', [1, 2, 3]), 'arity')) + call assert_equal({'required': 0, 'optional': 0, 'varargs': v:true}, + \ get(funcref('s:Qux', [1, 2, 3, 4]), 'arity')) + " More args than expected is not an error + call assert_equal({'required': 0, 'optional': 0, 'varargs': v:false}, + \ get(funcref('s:Qux1', [1, 2, 3, 4]), 'arity')) + + delfunc s:Qux + delfunc s:Qux1 endfunc func Test_compare_partials() -- cgit From 158ffd646d18eb26ca7e04e9cb9110305577b9c8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 10 Jul 2024 10:35:12 +0800 Subject: vim-patch:9.1.0554: :bw leaves jumplist and tagstack data around (#29639) Problem: :bw leaves jumplist and tagstack data around (Paul "Joey" Clark) Solution: Wipe jumplist and tagstack references to the wiped buffer (LemonBoy) As documented the :bwipeout command brutally deletes all the references to the buffer, so let's make it delete all the entries in the jump list and tag stack referring to the wiped-out buffer. fixes: vim/vim#8201 closes: vim/vim#15185 https://github.com/vim/vim/commit/4ff3a9b1e3ba45f9dbd0ea8c721f27d9315c4d93 Co-authored-by: LemonBoy --- test/old/testdir/test_jumplist.vim | 22 ++++++---------------- test/old/testdir/test_tagjump.vim | 17 +++++++++++++++++ test/old/testdir/test_winfixbuf.vim | 1 + 3 files changed, 24 insertions(+), 16 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_jumplist.vim b/test/old/testdir/test_jumplist.vim index b4dcdad9d6..5cf4f32628 100644 --- a/test/old/testdir/test_jumplist.vim +++ b/test/old/testdir/test_jumplist.vim @@ -68,26 +68,16 @@ endfunc func Test_jumplist_invalid() new clearjumps - " put some randome text - put ='a' - let prev = bufnr('%') + " Put some random text and fill the jump list. + call setline(1, ['foo', 'bar', 'baz']) + normal G + normal gg setl nomodified bufhidden=wipe e XXJumpListBuffer - let bnr = bufnr('%') - " 1) empty jumplist - let expected = [[ - \ {'lnum': 2, 'bufnr': prev, 'col': 0, 'coladd': 0}], 1] - call assert_equal(expected, getjumplist()) + " The jump list is empty as the buffer was wiped out. + call assert_equal([[], 0], getjumplist()) let jumps = execute(':jumps') call assert_equal('>', jumps[-1:]) - " now jump back - exe ":norm! \" - let expected = [[ - \ {'lnum': 2, 'bufnr': prev, 'col': 0, 'coladd': 0}, - \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 0] - call assert_equal(expected, getjumplist()) - let jumps = execute(':jumps') - call assert_match('> 0 2 0 -invalid-', jumps) endfunc " Test for '' mark in an empty buffer diff --git a/test/old/testdir/test_tagjump.vim b/test/old/testdir/test_tagjump.vim index a614c19ce2..b715aedde6 100644 --- a/test/old/testdir/test_tagjump.vim +++ b/test/old/testdir/test_tagjump.vim @@ -1001,6 +1001,23 @@ func Test_tag_stack() call settagstack(1, {'items' : []}) call assert_fails('pop', 'E73:') + " References to wiped buffer are deleted. + for i in range(10, 20) + edit Xtest + exe "tag var" .. i + endfor + edit Xtest + + let t = gettagstack() + call assert_equal(11, t.length) + call assert_equal(12, t.curidx) + + bwipe! + + let t = gettagstack() + call assert_equal(0, t.length) + call assert_equal(1, t.curidx) + set tags& %bwipe endfunc diff --git a/test/old/testdir/test_winfixbuf.vim b/test/old/testdir/test_winfixbuf.vim index b41eaf3c9b..1777bec184 100644 --- a/test/old/testdir/test_winfixbuf.vim +++ b/test/old/testdir/test_winfixbuf.vim @@ -2934,6 +2934,7 @@ func Test_tfirst() \ "Xtags", 'D') call writefile(["one", "two", "three"], "Xfile", 'D') call writefile(["one"], "Xother", 'D') + tag one edit Xother set winfixbuf -- cgit From 80530d07e75a98cdf65f1c731b031d05bc2f5087 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 9 Jul 2024 19:57:29 +0200 Subject: vim-patch:9.1.0552: No test for antlr4 filetype Problem: No test for antlr4 filetype (after 9.1.0550) Solution: Add a simple filename test related: vim/vim#15191 https://github.com/vim/vim/commit/8fc23bb8a433a28ccf1a60a48ad91bd7226c3d73 Co-authored-by: Christian Brabandt --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 71e3074d51..a421c83340 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -96,6 +96,7 @@ func s:GetFilenameChecks() abort \ 'aml': ['file.aml'], \ 'ampl': ['file.run'], \ 'ant': ['build.xml'], + \ 'antlr4': ['parser.g4'], \ 'apache': ['.htaccess', '/etc/httpd/file.conf', '/etc/apache2/sites-2/file.com', '/etc/apache2/some.config', '/etc/apache2/conf.file/conf', '/etc/apache2/mods-some/file', '/etc/apache2/sites-some/file', '/etc/httpd/conf.d/file.config', '/etc/apache2/conf.file/file', '/etc/apache2/file.conf', '/etc/apache2/file.conf-file', '/etc/apache2/mods-file/file', '/etc/apache2/sites-file/file', '/etc/apache2/sites-file/file.com', '/etc/httpd/conf.d/file.conf', '/etc/httpd/conf.d/file.conf-file', 'access.conf', 'access.conf-file', 'any/etc/apache2/conf.file/file', 'any/etc/apache2/file.conf', 'any/etc/apache2/file.conf-file', 'any/etc/apache2/mods-file/file', 'any/etc/apache2/sites-file/file', 'any/etc/apache2/sites-file/file.com', 'any/etc/httpd/conf.d/file.conf', 'any/etc/httpd/conf.d/file.conf-file', 'any/etc/httpd/file.conf', 'apache.conf', 'apache.conf-file', 'apache2.conf', 'apache2.conf-file', 'httpd.conf', 'httpd.conf-file', 'srm.conf', 'srm.conf-file', '/etc/httpd/mods-some/file', '/etc/httpd/sites-some/file', '/etc/httpd/conf.file/conf'], \ 'apachestyle': ['/etc/proftpd/file.config,/etc/proftpd/conf.file/file', '/etc/proftpd/conf.file/file', '/etc/proftpd/file.conf', '/etc/proftpd/file.conf-file', 'any/etc/proftpd/conf.file/file', 'any/etc/proftpd/file.conf', 'any/etc/proftpd/file.conf-file', 'proftpd.conf', 'proftpd.conf-file'], \ 'applescript': ['file.scpt'], -- cgit From 7fa089f463dac83f256a8336ddb0adc9eae483a2 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 9 Jul 2024 19:58:02 +0200 Subject: vim-patch:9.1.0551: filetype: htmlangular files are not properly detected Problem: filetype: htmlangular files are not properly detected Solution: Use the new htmlangular filetype for angular files, because since angular v17, those are no longer valid HTML files. (Dennis van den Berg) Since Angular 17, the new Control Flow Syntax is not valid HTML. This PR adds a new filetype detection for the HTML templates of Angular. It first checks the filename. The Angular convention is to use *.component.html for the template. However, this is not mandatory. If the filename does not match, it will check the contents of the file if it contains: - One of the Control-Flow blocks: @if, @for, @switch, @defer - A structural directive: *ngIf, *ngFor, *ngSwitch, *ngTemplateOutlet - Builtin Angular elements: ng-template or ng-content - String interpolation: {{ something }} This enables the Angular LSP to attach only to htmlangular filetypes, as well as language parsers, such as tree-sitter. closes: vim/vim#15190 https://github.com/vim/vim/commit/1ad194c0dfd82ca1e7a1b6f2fca89a487794158d Co-authored-by: Dennis van den Berg --- test/old/testdir/test_filetype.vim | 41 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index a421c83340..00756ad68a 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -336,7 +336,8 @@ func s:GetFilenameChecks() abort \ 'hoon': ['file.hoon'], \ 'hostconf': ['/etc/host.conf', 'any/etc/host.conf'], \ 'hostsaccess': ['/etc/hosts.allow', '/etc/hosts.deny', 'any/etc/hosts.allow', 'any/etc/hosts.deny'], - \ 'html': ['file.html', 'file.htm', 'file.cshtml', 'file.component.html'], + \ 'html': ['file.html', 'file.htm', 'file.cshtml'], + \ 'htmlangular': ['file.component.html'], \ 'htmlm4': ['file.html.m4'], \ 'httest': ['file.htt', 'file.htb'], \ 'hurl': ['file.hurl'], @@ -1045,7 +1046,8 @@ func Test_emptybuf_ftdetect() call assert_equal('', &filetype) filetype detect call assert_equal('sh', &filetype) - close! + " close the swapfile + bw! endfunc " Test for ':filetype indent on' and ':filetype indent off' commands @@ -1569,6 +1571,41 @@ func Test_hook_file() filetype off endfunc +func Test_html_file() + filetype on + + " HTML Angular + let content = ['@for (item of items; track item.name) {', '
  • {{ item.name }}
  • ', '} @empty {', '
  • There are no items.
  • ', '}'] + call writefile(content, 'Xfile.html', 'D') + split Xfile.html + call assert_equal('htmlangular', &filetype) + bwipe! + + " Django Template + let content = ['{% if foobar %}', + \ ' ', + \ '{% else %}', + \ '

    No polls are available.

    ', + \ '{% endif %}'] + call writefile(content, 'Xfile.html', 'D') + split Xfile.html + call assert_equal('htmldjango', &filetype) + bwipe! + + " regular HTML + let content = ['', '', ' Foobar', ' Content', ' ', ''] + call writefile(content, 'Xfile.html', 'D') + split Xfile.html + call assert_equal('html', &filetype) + bwipe! + + filetype off +endfunc + func Test_m_file() filetype on -- cgit From 17bc5af01bfb0141b0abbe5894dc1eca7eaa684f Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 9 Jul 2024 20:05:04 +0200 Subject: vim-patch:9.1.0553: filetype: *.mcmeta files are not recognized Problem: filetype: *.mcmeta files are not recognized Solution: Detect '*.mcmeta' files as json filetype (Tomodachi94) "pack.mcmeta" was added to the JSON tests because that is the most common filename with that extension. There are currently 34,000 instances of this file extension on GitHub: https://github.com/search?q=path%3A*.mcmeta&type=code&p=2 .zip files with this extension have downloads in the millions on sites like CurseForge: https://www.curseforge.com/minecraft/search?page=1&pageSize=20&sortBy=relevancy&class=texture-packs Further reading about the file extension: https://minecraft.wiki/w/Tutorials/Creating_a_resource_pack#Creating_a_.MCMETA_file closes: vim/vim#15189 https://github.com/vim/vim/commit/d33a518025765c4a3530ad6cfb6cab83a30c8f55 Co-authored-by: Tomodachi94 --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 00756ad68a..f2591c8577 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -369,7 +369,7 @@ func s:GetFilenameChecks() abort \ 'jq': ['file.jq'], \ 'jovial': ['file.jov', 'file.j73', 'file.jovial'], \ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file', 'org.eclipse.xyz.prefs'], - \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', '.lintstagedrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock'], + \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', '.lintstagedrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock', 'pack.mcmeta'], \ 'json5': ['file.json5'], \ 'jsonc': ['file.jsonc', '.babelrc', '.eslintrc', '.jsfmtrc', '.jshintrc', '.jscsrc', '.vsconfig', '.hintrc', '.swrc', 'jsconfig.json', 'tsconfig.json', 'tsconfig.test.json', 'tsconfig-test.json', '.luaurc'], \ 'jsonl': ['file.jsonl'], -- cgit From 07c1996c8ad69bae559406ae17c415e6cbd345e8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 11 Jul 2024 06:26:22 +0800 Subject: vim-patch:9.1.0556: :bwipe doesn't remove file from jumplist of other tabpages (#29651) Problem: :bwipe doesn't remove file from jumplist and tagstack of other tabpages. Time complexity of mark_forget_file() is O(n^2) when removing all entries (after v9.1.0554) Solution: Use FOR_ALL_TAB_WINDOWS(). Start the loops over the arrays from the end instead of the start (zeertzjq) closes: vim/vim#15199 https://github.com/vim/vim/commit/2e7d89b39883b0cfd3e615b02bd55186e00fb7ce --- test/old/testdir/test_jumplist.vim | 50 +++++++++++++++++++++++++++++++++++--- test/old/testdir/test_tagjump.vim | 40 +++++++++++++++++++++++++++++- 2 files changed, 85 insertions(+), 5 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_jumplist.vim b/test/old/testdir/test_jumplist.vim index 5cf4f32628..1feadead60 100644 --- a/test/old/testdir/test_jumplist.vim +++ b/test/old/testdir/test_jumplist.vim @@ -19,7 +19,7 @@ func Test_getjumplist() for i in range(1, 100) call add(lines, "Line " . i) endfor - call writefile(lines, "Xtest") + call writefile(lines, "Xtest", 'D') " Jump around and create a jump list edit Xtest @@ -61,11 +61,9 @@ func Test_getjumplist() clearjumps call test_garbagecollect_now() call assert_equal(4, l[1]) - - call delete("Xtest") endfunc -func Test_jumplist_invalid() +func Test_jumplist_wipe_buf() new clearjumps " Put some random text and fill the jump list. @@ -78,6 +76,50 @@ func Test_jumplist_invalid() call assert_equal([[], 0], getjumplist()) let jumps = execute(':jumps') call assert_equal('>', jumps[-1:]) + + " Put some random text and fill the jump list. + call setline(1, ['foo', 'bar', 'baz']) + setl bufhidden=hide + + " References to wiped buffer are deleted with multiple tabpages. + let [w1, t1] = [win_getid(), tabpagenr()] + clearjumps + normal G + normal gg + enew + + split XXJumpListBuffer + let [w2, t2] = [win_getid(), tabpagenr()] + clearjumps + normal G + normal gg + enew + + tabnew XXJumpListBuffer + let [w3, t3] = [win_getid(), tabpagenr()] + clearjumps + normal G + normal gg + enew + + split XXJumpListBuffer + let [w4, t4] = [win_getid(), tabpagenr()] + clearjumps + normal G + normal gg + enew + + for [w, t] in [[w1, t1], [w2, t2], [w3, t3], [w4, t4]] + call assert_equal(2, len(getjumplist(w, t)[0])) + endfor + + bwipe! XXJumpListBuffer + + for [w, t] in [[w1, t1], [w2, t2], [w3, t3], [w4, t4]] + call assert_equal(0, len(getjumplist(w, t)[0])) + endfor + + %bwipe! endfunc " Test for '' mark in an empty buffer diff --git a/test/old/testdir/test_tagjump.vim b/test/old/testdir/test_tagjump.vim index b715aedde6..6fbb3b09b2 100644 --- a/test/old/testdir/test_tagjump.vim +++ b/test/old/testdir/test_tagjump.vim @@ -1018,8 +1018,46 @@ func Test_tag_stack() call assert_equal(0, t.length) call assert_equal(1, t.curidx) + " References to wiped buffer are deleted with multiple tabpages. + let w1 = win_getid() + call settagstack(1, {'items' : []}) + for i in range(10, 20) | edit Xtest | exe "tag var" .. i | endfor + enew + + new + let w2 = win_getid() + call settagstack(1, {'items' : []}) + for i in range(10, 20) | edit Xtest | exe "tag var" .. i | endfor + enew + + tabnew + let w3 = win_getid() + call settagstack(1, {'items' : []}) + for i in range(10, 20) | edit Xtest | exe "tag var" .. i | endfor + enew + + new + let w4 = win_getid() + call settagstack(1, {'items' : []}) + for i in range(10, 20) | edit Xtest | exe "tag var" .. i | endfor + enew + + for w in [w1, w2, w3, w4] + let t = gettagstack(w) + call assert_equal(11, t.length) + call assert_equal(12, t.curidx) + endfor + + bwipe! Xtest + + for w in [w1, w2, w3, w4] + let t = gettagstack(w) + call assert_equal(0, t.length) + call assert_equal(1, t.curidx) + endfor + + %bwipe! set tags& - %bwipe endfunc " Test for browsing multiple matching tags -- cgit From afbe7736a4966f22146d857f246eac01cd080773 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 10 Jul 2024 19:47:28 +0200 Subject: vim-patch:9.1.0555: filetype: angular ft detection is still problematic Problem: filetype: angular ft detection is still problematic (after 9.1.0551) Solution: detect htmlangular filetype only by inspecting the content, do not try to determine it from a generic name like '*.component.html' For the reasons mentioned here: https://github.com/vim/vim/pull/13594#issuecomment-1834465890 related: vim/vim#15190 related: vim/vim#13594 related: vim/vim#13604 https://github.com/vim/vim/commit/c03f631b7b01e672787b222a55898f8dcac8d859 Co-authored-by: Christian Brabandt --- test/old/testdir/test_filetype.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index f2591c8577..a6df28696c 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -336,8 +336,7 @@ func s:GetFilenameChecks() abort \ 'hoon': ['file.hoon'], \ 'hostconf': ['/etc/host.conf', 'any/etc/host.conf'], \ 'hostsaccess': ['/etc/hosts.allow', '/etc/hosts.deny', 'any/etc/hosts.allow', 'any/etc/hosts.deny'], - \ 'html': ['file.html', 'file.htm', 'file.cshtml'], - \ 'htmlangular': ['file.component.html'], + \ 'html': ['file.html', 'file.htm', 'file.cshtml', 'file.component.html'], \ 'htmlm4': ['file.html.m4'], \ 'httest': ['file.htt', 'file.htb'], \ 'hurl': ['file.hurl'], -- cgit From 45b7a2c50335e1943a36715101e40eda5a1423f3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 11 Jul 2024 08:02:59 +0800 Subject: vim-patch:9.1.0557: moving in the buffer list doesn't work as documented (#29653) Problem: moving in the buffer list doesn't work as documented (SenileFelineS) Solution: Skip non-help buffers, when run from normal buffers, else only move from help buffers to the next help buffer (LemonBoy) As explained in the help section for :bnext and :bprev the commands should jump from help buffers to help buffers (and from regular ones to regular ones). fixes: vim/vim#4478 closes: vim/vim#15198 https://github.com/vim/vim/commit/893eeeb44583ca33276e263165b2a6e50fd297d0 Co-authored-by: LemonBoy --- test/old/testdir/test_buffer.vim | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_buffer.vim b/test/old/testdir/test_buffer.vim index bc8e5eaf7b..69d22de2ce 100644 --- a/test/old/testdir/test_buffer.vim +++ b/test/old/testdir/test_buffer.vim @@ -126,6 +126,52 @@ func Test_buflist_browse() %bwipe! endfunc +" Test for :bnext and :bprev when called from help and non-help buffers. +func Test_bnext_bprev_help() + %bwipe! + + e XHelp1 | set bt=help + let b1 = bufnr() + e Xbuf1 + let b2 = bufnr() + + " There's only one buffer of each type. + b XHelp1 + bnext | call assert_equal(b1, bufnr()) + bprev | call assert_equal(b1, bufnr()) + b Xbuf1 + bnext | call assert_equal(b2, bufnr()) + bprev | call assert_equal(b2, bufnr()) + + " Add one more buffer of each type. + e XHelp2 | set bt=help + let b3 = bufnr() + e Xbuf2 + let b4 = bufnr() + + " Help buffer jumps to help buffer. + b XHelp1 + bnext | call assert_equal(b3, bufnr()) + bnext | call assert_equal(b1, bufnr()) + bprev | call assert_equal(b3, bufnr()) + bprev | call assert_equal(b1, bufnr()) + + " Regular buffer jumps to regular buffer. + b Xbuf1 + bnext | call assert_equal(b4, bufnr()) + bnext | call assert_equal(b2, bufnr()) + bprev | call assert_equal(b4, bufnr()) + bprev | call assert_equal(b2, bufnr()) + + " :brewind and :blast are not affected by the buffer type. + b Xbuf2 + brewind | call assert_equal(b1, bufnr()) + b XHelp1 + blast | call assert_equal(b4, bufnr()) + + %bwipe! +endfunc + " Test for :bdelete func Test_bdelete_cmd() %bwipe! -- cgit From 31d53cbb0fff48488f45ba234b8d595c31507739 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 12 Jul 2024 06:33:54 +0800 Subject: vim-patch:8.2.3388: fnamemodify('path/..', ':p') differs from using 'path/../' (#29667) Problem: fnamemodify('path/..', ':p') differs from using 'path/../'. Solution: Include the "/.." in the directory name. (closes vim/vim#8808) https://github.com/vim/vim/commit/4eaef9979fc5032606897963f1af37674ee0d422 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_fnamemodify.vim | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_fnamemodify.vim b/test/old/testdir/test_fnamemodify.vim index 258a2093bd..2e6c7b8a1e 100644 --- a/test/old/testdir/test_fnamemodify.vim +++ b/test/old/testdir/test_fnamemodify.vim @@ -12,6 +12,8 @@ func Test_fnamemodify() call assert_equal('r', fnamemodify('.', ':p:h')[-1:]) call assert_equal('t', fnamemodify('test.out', ':p')[-1:]) call assert_equal($HOME .. "/foo" , fnamemodify('~/foo', ':p')) + call assert_equal(fnamemodify('.', ':p:h:h:h') .. '/', fnamemodify($HOME .. '/../', ':p')) + call assert_equal(fnamemodify('.', ':p:h:h:h') .. '/', fnamemodify($HOME .. '/..', ':p')) call assert_equal('test.out', fnamemodify('test.out', ':.')) call assert_equal('a', fnamemodify('../testdir/a', ':.')) call assert_equal('~/testdir/test.out', fnamemodify('test.out', ':~')) -- cgit From 2c9e82e193463180fe9af6435f491f24ed69ab90 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 12 Jul 2024 05:43:06 +0800 Subject: vim-patch:partial:9.0.0323: using common name in tests leads to flaky tests Problem: Using common name in tests leads to flaky tests. Solution: Rename files and directories to be more specific. https://github.com/vim/vim/commit/3b0d70f4ff436cb144683dafd956e8a3ee485a90 This only includes test_findfile.vim changes. vim-patch:9.1.0562: tests: inconsistency in test_findfile.vim Problem: tests: inconsistency in test_findfile.vim, it saves and restores 'shellslash', but doesn't actually set it Solution: Set shellslash explicitly (zeertzjq) closes: vim/vim#15217 https://github.com/vim/vim/commit/e7b98ab96e1f1bd12032c620615a2c69adbf018d Co-authored-by: Bram Moolenaar --- test/old/testdir/test_findfile.vim | 68 +++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_findfile.vim b/test/old/testdir/test_findfile.vim index 0f4b30aec2..622a428bf8 100644 --- a/test/old/testdir/test_findfile.vim +++ b/test/old/testdir/test_findfile.vim @@ -1,14 +1,14 @@ " Test findfile() and finddir() -let s:files = [ 'Xdir1/foo', - \ 'Xdir1/bar', - \ 'Xdir1/Xdir2/foo', - \ 'Xdir1/Xdir2/foobar', - \ 'Xdir1/Xdir2/Xdir3/bar', - \ 'Xdir1/Xdir2/Xdir3/barfoo' ] +let s:files = [ 'Xfinddir1/foo', + \ 'Xfinddir1/bar', + \ 'Xfinddir1/Xdir2/foo', + \ 'Xfinddir1/Xdir2/foobar', + \ 'Xfinddir1/Xdir2/Xdir3/bar', + \ 'Xfinddir1/Xdir2/Xdir3/barfoo' ] func CreateFiles() - call mkdir('Xdir1/Xdir2/Xdir3/Xdir2', 'p') + call mkdir('Xfinddir1/Xdir2/Xdir3/Xdir2', 'p') for f in s:files call writefile([], f) endfor @@ -16,15 +16,15 @@ endfunc func CleanFiles() " Safer to delete each file even if it's more verbose - " than doing a recursive delete('Xdir1', 'rf'). + " than doing a recursive delete('Xfinddir1', 'rf'). for f in s:files call delete(f) endfor - call delete('Xdir1/Xdir2/Xdir3/Xdir2', 'd') - call delete('Xdir1/Xdir2/Xdir3', 'd') - call delete('Xdir1/Xdir2', 'd') - call delete('Xdir1', 'd') + call delete('Xfinddir1/Xdir2/Xdir3/Xdir2', 'd') + call delete('Xfinddir1/Xdir2/Xdir3', 'd') + call delete('Xfinddir1/Xdir2', 'd') + call delete('Xfinddir1', 'd') endfunc " Test findfile({name} [, {path} [, {count}]]) @@ -34,7 +34,7 @@ func Test_findfile() let save_dir = getcwd() set shellslash call CreateFiles() - cd Xdir1 + cd Xfinddir1 e Xdir2/foo " With ,, in path, findfile() searches in current directory. @@ -83,34 +83,34 @@ func Test_findfile() " Test upwards search. cd Xdir2/Xdir3 call assert_equal('bar', findfile('bar', ';')) - call assert_match('.*/Xdir1/Xdir2/foo', findfile('foo', ';')) - call assert_match('.*/Xdir1/Xdir2/foo', findfile('foo', ';', 1)) - call assert_match('.*/Xdir1/foo', findfile('foo', ';', 2)) - call assert_match('.*/Xdir1/foo', findfile('foo', ';', 2)) - call assert_match('.*/Xdir1/Xdir2/foo', findfile('foo', 'Xdir2;', 1)) + call assert_match('.*/Xfinddir1/Xdir2/foo', findfile('foo', ';')) + call assert_match('.*/Xfinddir1/Xdir2/foo', findfile('foo', ';', 1)) + call assert_match('.*/Xfinddir1/foo', findfile('foo', ';', 2)) + call assert_match('.*/Xfinddir1/foo', findfile('foo', ';', 2)) + call assert_match('.*/Xfinddir1/Xdir2/foo', findfile('foo', 'Xdir2;', 1)) call assert_equal('', findfile('foo', 'Xdir2;', 2)) " List l should have at least 2 values (possibly more if foo file - " happens to be found upwards above Xdir1). + " happens to be found upwards above Xfinddir1). let l = findfile('foo', ';', -1) - call assert_match('.*/Xdir1/Xdir2/foo', l[0]) - call assert_match('.*/Xdir1/foo', l[1]) + call assert_match('.*/Xfinddir1/Xdir2/foo', l[0]) + call assert_match('.*/Xfinddir1/foo', l[1]) " Test upwards search with stop-directory. cd Xdir2 - let l = findfile('bar', ';' . save_dir . '/Xdir1/Xdir2/', -1) + let l = findfile('bar', ';' . save_dir . '/Xfinddir1/Xdir2/', -1) call assert_equal(1, len(l)) - call assert_match('.*/Xdir1/Xdir2/Xdir3/bar', l[0]) + call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) - let l = findfile('bar', ';' . save_dir . '/Xdir1/', -1) + let l = findfile('bar', ';' . save_dir . '/Xfinddir1/', -1) call assert_equal(2, len(l)) - call assert_match('.*/Xdir1/Xdir2/Xdir3/bar', l[0]) - call assert_match('.*/Xdir1/bar', l[1]) + call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) + call assert_match('.*/Xfinddir1/bar', l[1]) " Test combined downwards and upwards search from Xdir2/. cd ../.. call assert_equal('Xdir3/bar', findfile('bar', '**;', 1)) - call assert_match('.*/Xdir1/bar', findfile('bar', '**;', 2)) + call assert_match('.*/Xfinddir1/bar', findfile('bar', '**;', 2)) bwipe! call chdir(save_dir) @@ -135,7 +135,7 @@ func Test_finddir() set path=,, set shellslash call CreateFiles() - cd Xdir1 + cd Xfinddir1 call assert_equal('Xdir2', finddir('Xdir2')) call assert_equal('', 'Xdir3'->finddir()) @@ -158,17 +158,17 @@ func Test_finddir() " Test upwards dir search. cd Xdir2/Xdir3 - call assert_match('.*/Xdir1', finddir('Xdir1', ';')) + call assert_match('.*/Xfinddir1', finddir('Xfinddir1', ';')) " Test upwards search with stop-directory. - call assert_match('.*/Xdir1', finddir('Xdir1', ';' . save_dir . '/')) - call assert_equal('', finddir('Xdir1', ';' . save_dir . '/Xdir1/')) + call assert_match('.*/Xfinddir1', finddir('Xfinddir1', ';' . save_dir . '/')) + call assert_equal('', finddir('Xfinddir1', ';' . save_dir . '/Xfinddir1/')) " Test combined downwards and upwards dir search from Xdir2/. cd .. - call assert_match('.*/Xdir1', finddir('Xdir1', '**;', 1)) + call assert_match('.*/Xfinddir1', finddir('Xfinddir1', '**;', 1)) call assert_equal('Xdir3/Xdir2', finddir('Xdir2', '**;', 1)) - call assert_match('.*/Xdir1/Xdir2', finddir('Xdir2', '**;', 2)) + call assert_match('.*/Xfinddir1/Xdir2', finddir('Xdir2', '**;', 2)) call assert_equal('Xdir3', finddir('Xdir3', '**;', 1)) call chdir(save_dir) @@ -192,7 +192,7 @@ func Test_find_cmd() let save_dir = getcwd() set path=.,./**/* call CreateFiles() - cd Xdir1 + cd Xfinddir1 " Test for :find find foo -- cgit From 50feb85b0c1e29583c6f6f928512e7b853a3ebf6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 12 Jul 2024 05:45:40 +0800 Subject: vim-patch:9.1.0565: Stop directory doesn't work properly in 'tags' Problem: Stop directory doesn't work properly in 'tags'. (Jesse Pavel) Solution: Also move the stop directory forward by one byte. (zeertzjq) This doesn't support relative stop directories yet, as they are not supported in other places like findfile() either. fixes: vim/vim#15200 related: vim/vim#15202 https://github.com/vim/vim/commit/68819afb2cdd0f44baa080db589e1d8f77099e5f --- test/old/testdir/test_taglist.vim | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_taglist.vim b/test/old/testdir/test_taglist.vim index 75d28c3ec4..d74bd1e0e1 100644 --- a/test/old/testdir/test_taglist.vim +++ b/test/old/testdir/test_taglist.vim @@ -135,6 +135,29 @@ func Test_tagsfile_without_trailing_newline() set tags& endfunc +" Check that specifying a stop directory in 'tags' works properly. +func Test_tagfiles_stopdir() + let save_cwd = getcwd() + + call mkdir('Xtagsdir1/Xtagsdir2/Xtagsdir3', 'pR') + call writefile([], 'Xtagsdir1/Xtags', 'D') + + cd Xtagsdir1/ + let &tags = './Xtags;' .. fnamemodify('./..', ':p') + call assert_equal(1, len(tagfiles())) + + cd Xtagsdir2/ + let &tags = './Xtags;' .. fnamemodify('./..', ':p') + call assert_equal(1, len(tagfiles())) + + cd Xtagsdir3/ + let &tags = './Xtags;' .. fnamemodify('./..', ':p') + call assert_equal(0, len(tagfiles())) + + set tags& + call chdir(save_cwd) +endfunc + " Test for ignoring comments in a tags file func Test_tagfile_ignore_comments() call writefile([ -- cgit From 091a130804282c9d40e639d68659d2ea2941259d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 12 Jul 2024 06:39:17 +0800 Subject: vim-patch:9.1.0566: Stop dir in findfile() doesn't work properly w/o trailing slash Problem: Stop directory in findfile() doesn't work properly without a trailing slash. Solution: Always use fnamencmp(), not fnamecmp(). related: vim/vim#15200 related: vim/vim#15202 https://github.com/vim/vim/commit/e6ab23bd4a41840860ae2904956c4d255a9dd528 --- test/old/testdir/test_findfile.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_findfile.vim b/test/old/testdir/test_findfile.vim index 622a428bf8..0c663f0923 100644 --- a/test/old/testdir/test_findfile.vim +++ b/test/old/testdir/test_findfile.vim @@ -101,11 +101,18 @@ func Test_findfile() let l = findfile('bar', ';' . save_dir . '/Xfinddir1/Xdir2/', -1) call assert_equal(1, len(l)) call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) + let l = findfile('bar', ';' . save_dir . '/Xfinddir1/Xdir2', -1) + call assert_equal(1, len(l)) + call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) let l = findfile('bar', ';' . save_dir . '/Xfinddir1/', -1) call assert_equal(2, len(l)) call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) call assert_match('.*/Xfinddir1/bar', l[1]) + let l = findfile('bar', ';' . save_dir . '/Xfinddir1', -1) + call assert_equal(2, len(l)) + call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) + call assert_match('.*/Xfinddir1/bar', l[1]) " Test combined downwards and upwards search from Xdir2/. cd ../.. -- cgit From 80818641f3504eb57a4fae5003f234f5f5f19ba1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 12 Jul 2024 06:45:39 +0800 Subject: vim-patch:9.1.0567: Cannot use relative paths as findfile() stop directories Problem: Cannot use relative paths as findfile() stop directories. Solution: Change a relative path to an absolute path. (zeertzjq) related: vim/vim#15200 closes: vim/vim#15202 https://github.com/vim/vim/commit/764526e2799fbed040fc867858ee2eb0677afe98 --- test/old/testdir/test_findfile.vim | 17 +++++++++++++++++ test/old/testdir/test_taglist.vim | 9 +++++++++ 2 files changed, 26 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_findfile.vim b/test/old/testdir/test_findfile.vim index 0c663f0923..0b241e3466 100644 --- a/test/old/testdir/test_findfile.vim +++ b/test/old/testdir/test_findfile.vim @@ -98,12 +98,25 @@ func Test_findfile() " Test upwards search with stop-directory. cd Xdir2 + let l = findfile('bar', ';' . save_dir . '/Xfinddir1/Xdir2/Xdir3/', -1) + call assert_equal(1, len(l)) + call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) + let l = findfile('bar', ';' . save_dir . '/Xfinddir1/Xdir2/Xdir3', -1) + call assert_equal(1, len(l)) + call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) + let l = findfile('bar', ';../', -1) + call assert_equal(1, len(l)) + call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) + let l = findfile('bar', ';' . save_dir . '/Xfinddir1/Xdir2/', -1) call assert_equal(1, len(l)) call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) let l = findfile('bar', ';' . save_dir . '/Xfinddir1/Xdir2', -1) call assert_equal(1, len(l)) call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) + let l = findfile('bar', ';../../', -1) + call assert_equal(1, len(l)) + call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) let l = findfile('bar', ';' . save_dir . '/Xfinddir1/', -1) call assert_equal(2, len(l)) @@ -113,6 +126,10 @@ func Test_findfile() call assert_equal(2, len(l)) call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) call assert_match('.*/Xfinddir1/bar', l[1]) + let l = findfile('bar', ';../../../', -1) + call assert_equal(2, len(l)) + call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) + call assert_match('.*/Xfinddir1/bar', l[1]) " Test combined downwards and upwards search from Xdir2/. cd ../.. diff --git a/test/old/testdir/test_taglist.vim b/test/old/testdir/test_taglist.vim index d74bd1e0e1..92d6d283ed 100644 --- a/test/old/testdir/test_taglist.vim +++ b/test/old/testdir/test_taglist.vim @@ -154,6 +154,15 @@ func Test_tagfiles_stopdir() let &tags = './Xtags;' .. fnamemodify('./..', ':p') call assert_equal(0, len(tagfiles())) + let &tags = './Xtags;../' + call assert_equal(0, len(tagfiles())) + + cd .. + call assert_equal(1, len(tagfiles())) + + cd .. + call assert_equal(1, len(tagfiles())) + set tags& call chdir(save_cwd) endfunc -- cgit From a61666293d83cbaab1883bbb6e4895faff515c7f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 12 Jul 2024 07:27:33 +0800 Subject: vim-patch:partial:9.0.0323: using common name in tests leads to flaky tests Problem: Using common name in tests leads to flaky tests. Solution: Rename files and directories to be more specific. https://github.com/vim/vim/commit/3b0d70f4ff436cb144683dafd956e8a3ee485a90 This only includes test_cd.vim changes. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_cd.vim | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cd.vim b/test/old/testdir/test_cd.vim index cffba99451..131dcc6b9a 100644 --- a/test/old/testdir/test_cd.vim +++ b/test/old/testdir/test_cd.vim @@ -69,11 +69,11 @@ endfunc " Test for chdir() func Test_chdir_func() let topdir = getcwd() - call mkdir('Xdir/y/z', 'p') + call mkdir('Xchdir/y/z', 'p') " Create a few tabpages and windows with different directories new - cd Xdir + cd Xchdir tabnew tcd y below new @@ -81,22 +81,22 @@ func Test_chdir_func() lcd z tabfirst - call assert_match('^\[global\] .*/Xdir$', trim(execute('verbose pwd'))) + call assert_match('^\[global\] .*/Xchdir$', trim(execute('verbose pwd'))) call chdir('..') call assert_equal('y', fnamemodify(getcwd(1, 2), ':t')) call assert_equal('z', fnamemodify(3->getcwd(2), ':t')) tabnext | wincmd t call assert_match('^\[tabpage\] .*/y$', trim(execute('verbose pwd'))) eval '..'->chdir() - call assert_equal('Xdir', fnamemodify(getcwd(1, 2), ':t')) - call assert_equal('Xdir', fnamemodify(getcwd(2, 2), ':t')) + call assert_equal('Xchdir', fnamemodify(getcwd(1, 2), ':t')) + call assert_equal('Xchdir', fnamemodify(getcwd(2, 2), ':t')) call assert_equal('z', fnamemodify(getcwd(3, 2), ':t')) call assert_equal('testdir', fnamemodify(getcwd(1, 1), ':t')) 3wincmd w call assert_match('^\[window\] .*/z$', trim(execute('verbose pwd'))) call chdir('..') - call assert_equal('Xdir', fnamemodify(getcwd(1, 2), ':t')) - call assert_equal('Xdir', fnamemodify(getcwd(2, 2), ':t')) + call assert_equal('Xchdir', fnamemodify(getcwd(1, 2), ':t')) + call assert_equal('Xchdir', fnamemodify(getcwd(2, 2), ':t')) call assert_equal('y', fnamemodify(getcwd(3, 2), ':t')) call assert_equal('testdir', fnamemodify(getcwd(1, 1), ':t')) @@ -110,20 +110,20 @@ func Test_chdir_func() only | tabonly call chdir(topdir) - call delete('Xdir', 'rf') + call delete('Xchdir', 'rf') endfunc " Test for changing to the previous directory '-' func Test_prev_dir() let topdir = getcwd() - call mkdir('Xdir/a/b/c', 'p') + call mkdir('Xprevdir/a/b/c', 'p') " Create a few tabpages and windows with different directories new | only tabnew | new tabnew tabfirst - cd Xdir + cd Xprevdir tabnext | wincmd t tcd a wincmd w @@ -143,7 +143,7 @@ func Test_prev_dir() " Check the directory of all the windows tabfirst - call assert_equal('Xdir', fnamemodify(getcwd(), ':t')) + call assert_equal('Xprevdir', fnamemodify(getcwd(), ':t')) tabnext | wincmd t call assert_equal('a', fnamemodify(getcwd(), ':t')) wincmd w @@ -163,7 +163,7 @@ func Test_prev_dir() " Check the directory of all the windows tabfirst - call assert_equal('Xdir', fnamemodify(getcwd(), ':t')) + call assert_equal('Xprevdir', fnamemodify(getcwd(), ':t')) tabnext | wincmd t call assert_equal('a', fnamemodify(getcwd(), ':t')) wincmd w @@ -173,7 +173,7 @@ func Test_prev_dir() only | tabonly call chdir(topdir) - call delete('Xdir', 'rf') + call delete('Xprevdir', 'rf') endfunc func Test_lcd_split() -- cgit From f1827d877d3dece7d743e9db28384ebd5e10550c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 12 Jul 2024 07:25:46 +0800 Subject: vim-patch:partial:9.0.0418: manually deleting temp test files Problem: Manually deleting temp test files. Solution: Use the 'D' flag of writefile() and mkdir(). https://github.com/vim/vim/commit/45bbaef0382c5468d9fac511775bd99ea7bf5b84 This only includes test_cd.vim changes. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_cd.vim | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cd.vim b/test/old/testdir/test_cd.vim index 131dcc6b9a..7ef64d6ffb 100644 --- a/test/old/testdir/test_cd.vim +++ b/test/old/testdir/test_cd.vim @@ -58,18 +58,17 @@ func Test_cd_minus() call writefile(v:errors, 'Xresult') qall! [SCRIPT] - call writefile(lines, 'Xscript') + call writefile(lines, 'Xscript', 'D') if RunVim([], [], '--clean -S Xscript') call assert_equal([], readfile('Xresult')) endif - call delete('Xscript') call delete('Xresult') endfunc " Test for chdir() func Test_chdir_func() let topdir = getcwd() - call mkdir('Xchdir/y/z', 'p') + call mkdir('Xchdir/y/z', 'pR') " Create a few tabpages and windows with different directories new @@ -110,13 +109,12 @@ func Test_chdir_func() only | tabonly call chdir(topdir) - call delete('Xchdir', 'rf') endfunc " Test for changing to the previous directory '-' func Test_prev_dir() let topdir = getcwd() - call mkdir('Xprevdir/a/b/c', 'p') + call mkdir('Xprevdir/a/b/c', 'pR') " Create a few tabpages and windows with different directories new | only @@ -173,7 +171,6 @@ func Test_prev_dir() only | tabonly call chdir(topdir) - call delete('Xprevdir', 'rf') endfunc func Test_lcd_split() @@ -201,22 +198,18 @@ func Test_cd_from_non_existing_dir() endfunc func Test_cd_completion() - call mkdir('XComplDir1', 'p') - call mkdir('XComplDir2', 'p') - call writefile([], 'XComplFile') + call mkdir('XComplDir1', 'D') + call mkdir('XComplDir2', 'D') + call writefile([], 'XComplFile', 'D') for cmd in ['cd', 'chdir', 'lcd', 'lchdir', 'tcd', 'tchdir'] call feedkeys(':' .. cmd .. " XCompl\\\"\", 'tx') call assert_equal('"' .. cmd .. ' XComplDir1/ XComplDir2/', @:) endfor - - call delete('XComplDir1', 'd') - call delete('XComplDir2', 'd') - call delete('XComplFile') endfunc func Test_cd_unknown_dir() - call mkdir('Xa') + call mkdir('Xa', 'R') cd Xa call writefile(['text'], 'Xb.txt') edit Xa/Xb.txt @@ -229,7 +222,6 @@ func Test_cd_unknown_dir() bwipe! exe "bwipe! " .. first_buf - call delete('Xa', 'rf') endfunc func Test_getcwd_actual_dir() @@ -237,7 +229,7 @@ func Test_getcwd_actual_dir() CheckOption autochdir let startdir = getcwd() - call mkdir('Xactual') + call mkdir('Xactual', 'R') call test_autochdir() set autochdir edit Xactual/file.txt @@ -251,7 +243,6 @@ func Test_getcwd_actual_dir() set noautochdir bwipe! call chdir(startdir) - call delete('Xactual', 'rf') endfunc " vim: shiftwidth=2 sts=2 expandtab -- cgit From 83f42aa450582594f0be044c9f0710809ef0f93d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 12 Jul 2024 07:11:54 +0800 Subject: vim-patch:9.1.0568: Cannot expand paths from 'cdpath' setting Problem: Cannot expand paths from 'cdpath' setting (Daniel Hahler) Solution: Implement 'cdpath' completion, add the new 'dir_in_path' completion type (LemonBoy) fixes vim/vim#374 closes: vim/vim#15205 https://github.com/vim/vim/commit/a20bf69a3b32024cb7809be87af33bf9dc490a19 Co-authored-by: LemonBoy --- test/old/testdir/test_cd.vim | 8 ++++++++ test/old/testdir/test_cmdline.vim | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cd.vim b/test/old/testdir/test_cd.vim index 7ef64d6ffb..dd92fc6c38 100644 --- a/test/old/testdir/test_cd.vim +++ b/test/old/testdir/test_cd.vim @@ -200,12 +200,20 @@ endfunc func Test_cd_completion() call mkdir('XComplDir1', 'D') call mkdir('XComplDir2', 'D') + call mkdir('sub/XComplDir3', 'pD') call writefile([], 'XComplFile', 'D') for cmd in ['cd', 'chdir', 'lcd', 'lchdir', 'tcd', 'tchdir'] call feedkeys(':' .. cmd .. " XCompl\\\"\", 'tx') call assert_equal('"' .. cmd .. ' XComplDir1/ XComplDir2/', @:) endfor + + set cdpath+=sub + for cmd in ['cd', 'chdir', 'lcd', 'lchdir', 'tcd', 'tchdir'] + call feedkeys(':' .. cmd .. " XCompl\\\"\", 'tx') + call assert_equal('"' .. cmd .. ' XComplDir1/ XComplDir2/ XComplDir3/', @:) + endfor + set cdpath& endfunc func Test_cd_unknown_dir() diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index 24811d49db..d00b5bbf46 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -645,7 +645,8 @@ func Test_getcompletion() unlet g:cmdline_compl_params " For others test if the name is recognized. - let names = ['buffer', 'environment', 'file_in_path', 'mapping', 'tag', 'tag_listfiles', 'user'] + let names = ['buffer', 'environment', 'file_in_path', 'dir_in_path', 'mapping', 'tag', + \ 'tag_listfiles', 'user'] if has('cmdline_hist') call add(names, 'history') endif -- cgit From 028dd3c5c4d1828eec64c099d3372ffb90572dc0 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 12 Jul 2024 14:30:49 +0800 Subject: vim-patch:9.1.0569: fnamemodify() treats ".." and "../" differently (#29673) Problem: fnamemodify() treats ".." and "../" differently. Solution: Expand ".." properly like how "/.." is treated in 8.2.3388. (zeertzjq) closes: vim/vim#15218 https://github.com/vim/vim/commit/1ee7420460768df67ea4bc73467f2d4f8b1555bd --- test/old/testdir/test_findfile.vim | 10 ++++++++++ test/old/testdir/test_fnamemodify.vim | 2 ++ test/old/testdir/test_taglist.vim | 15 ++++++++++++--- 3 files changed, 24 insertions(+), 3 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_findfile.vim b/test/old/testdir/test_findfile.vim index 0b241e3466..06d781ed69 100644 --- a/test/old/testdir/test_findfile.vim +++ b/test/old/testdir/test_findfile.vim @@ -107,6 +107,9 @@ func Test_findfile() let l = findfile('bar', ';../', -1) call assert_equal(1, len(l)) call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) + let l = findfile('bar', ';..', -1) + call assert_equal(1, len(l)) + call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) let l = findfile('bar', ';' . save_dir . '/Xfinddir1/Xdir2/', -1) call assert_equal(1, len(l)) @@ -117,6 +120,9 @@ func Test_findfile() let l = findfile('bar', ';../../', -1) call assert_equal(1, len(l)) call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) + let l = findfile('bar', ';../..', -1) + call assert_equal(1, len(l)) + call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) let l = findfile('bar', ';' . save_dir . '/Xfinddir1/', -1) call assert_equal(2, len(l)) @@ -130,6 +136,10 @@ func Test_findfile() call assert_equal(2, len(l)) call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) call assert_match('.*/Xfinddir1/bar', l[1]) + let l = findfile('bar', ';../../..', -1) + call assert_equal(2, len(l)) + call assert_match('.*/Xfinddir1/Xdir2/Xdir3/bar', l[0]) + call assert_match('.*/Xfinddir1/bar', l[1]) " Test combined downwards and upwards search from Xdir2/. cd ../.. diff --git a/test/old/testdir/test_fnamemodify.vim b/test/old/testdir/test_fnamemodify.vim index 2e6c7b8a1e..f0bc2503b5 100644 --- a/test/old/testdir/test_fnamemodify.vim +++ b/test/old/testdir/test_fnamemodify.vim @@ -14,6 +14,8 @@ func Test_fnamemodify() call assert_equal($HOME .. "/foo" , fnamemodify('~/foo', ':p')) call assert_equal(fnamemodify('.', ':p:h:h:h') .. '/', fnamemodify($HOME .. '/../', ':p')) call assert_equal(fnamemodify('.', ':p:h:h:h') .. '/', fnamemodify($HOME .. '/..', ':p')) + call assert_equal(fnamemodify('.', ':p:h:h') .. '/', fnamemodify('../', ':p')) + call assert_equal(fnamemodify('.', ':p:h:h') .. '/', fnamemodify('..', ':p')) call assert_equal('test.out', fnamemodify('test.out', ':.')) call assert_equal('a', fnamemodify('../testdir/a', ':.')) call assert_equal('~/testdir/test.out', fnamemodify('test.out', ':~')) diff --git a/test/old/testdir/test_taglist.vim b/test/old/testdir/test_taglist.vim index 92d6d283ed..fbb682a9b2 100644 --- a/test/old/testdir/test_taglist.vim +++ b/test/old/testdir/test_taglist.vim @@ -143,15 +143,15 @@ func Test_tagfiles_stopdir() call writefile([], 'Xtagsdir1/Xtags', 'D') cd Xtagsdir1/ - let &tags = './Xtags;' .. fnamemodify('./..', ':p') + let &tags = './Xtags;' .. fnamemodify('..', ':p') call assert_equal(1, len(tagfiles())) cd Xtagsdir2/ - let &tags = './Xtags;' .. fnamemodify('./..', ':p') + let &tags = './Xtags;' .. fnamemodify('..', ':p') call assert_equal(1, len(tagfiles())) cd Xtagsdir3/ - let &tags = './Xtags;' .. fnamemodify('./..', ':p') + let &tags = './Xtags;' .. fnamemodify('..', ':p') call assert_equal(0, len(tagfiles())) let &tags = './Xtags;../' @@ -163,6 +163,15 @@ func Test_tagfiles_stopdir() cd .. call assert_equal(1, len(tagfiles())) + let &tags = './Xtags;..' + call assert_equal(1, len(tagfiles())) + + cd Xtagsdir2/ + call assert_equal(1, len(tagfiles())) + + cd Xtagsdir3/ + call assert_equal(0, len(tagfiles())) + set tags& call chdir(save_cwd) endfunc -- cgit From b1aa8f5eb8a5407e869335e9987b73f8515c37e5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 13 Jul 2024 08:56:58 +0800 Subject: vim-patch:9.1.0572: cannot specify tab page closing behaviour (#29682) Problem: cannot specify tab page closing behaviour (Gianluca Pacchiella) Solution: Add the 'tabclose' option (LemonBoy). fixes: vim/vim#5967 closes: vim/vim#15204 https://github.com/vim/vim/commit/5247b0b92e191a046b034171a3b34031e317735f Co-authored-by: LemonBoy --- test/old/testdir/test_options.vim | 8 ++++-- test/old/testdir/test_tabpage.vim | 58 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index f7eace59c2..26b4f64487 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -558,6 +558,9 @@ func Test_set_completion_string_values() " call assert_equal('sync', getcompletion('set swapsync=', 'cmdline')[1]) call assert_equal('usetab', getcompletion('set switchbuf=', 'cmdline')[1]) call assert_equal('ignore', getcompletion('set tagcase=', 'cmdline')[1]) + if exists('+tabclose') + call assert_equal('left uselast', join(sort(getcompletion('set tabclose=', 'cmdline'))), ' ') + endif if exists('+termwintype') call assert_equal('conpty', getcompletion('set termwintype=', 'cmdline')[1]) endif @@ -1377,9 +1380,10 @@ func Test_write() new call setline(1, ['L1']) set nowrite - call assert_fails('write Xfile', 'E142:') + call assert_fails('write Xwrfile', 'E142:') set write - close! + " close swapfile + bw! endfunc " Test for 'buftype' option diff --git a/test/old/testdir/test_tabpage.vim b/test/old/testdir/test_tabpage.vim index 2bd2907a55..482da2de7f 100644 --- a/test/old/testdir/test_tabpage.vim +++ b/test/old/testdir/test_tabpage.vim @@ -967,6 +967,64 @@ func Test_tabpage_alloc_failure() call assert_equal(1, tabpagenr('$')) endfunc +func Test_tabpage_tabclose() + " Default behaviour, move to the right. + call s:reconstruct_tabpage_for_test(6) + norm! 4gt + setl tcl= + tabclose + call assert_equal("n3", bufname()) + + " Move to the left. + call s:reconstruct_tabpage_for_test(6) + norm! 4gt + setl tcl=left + tabclose + call assert_equal("n1", bufname()) + + " Move to the last used tab page. + call s:reconstruct_tabpage_for_test(6) + norm! 5gt + norm! 2gt + setl tcl=uselast + tabclose + call assert_equal("n3", bufname()) + + " Same, but the last used tab page is invalid. Move to the right. + call s:reconstruct_tabpage_for_test(6) + norm! 5gt + norm! 3gt + setl tcl=uselast + tabclose 5 + tabclose! + call assert_equal("n2", bufname()) + + " Same, but the last used tab page is invalid. Move to the left. + call s:reconstruct_tabpage_for_test(6) + norm! 5gt + norm! 3gt + setl tcl=uselast,left + tabclose 5 + tabclose! + call assert_equal("n0", bufname()) + + " Move left when moving right is not possible. + call s:reconstruct_tabpage_for_test(6) + setl tcl= + norm! 6gt + tabclose + call assert_equal("n3", bufname()) + + " Move right when moving left is not possible. + call s:reconstruct_tabpage_for_test(6) + setl tcl=left + norm! 1gt + tabclose + call assert_equal("n0", bufname()) + + setl tcl& +endfunc + " this was giving ml_get errors func Test_tabpage_last_line() enew -- cgit From c31f64dd4d1aa0b89ed76c4e808d664b4f349f50 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 14 Jul 2024 05:54:31 +0800 Subject: vim-patch:9.1.0577: Unnecessary checks for v:sizeoflong in test_put.vim Problem: Unnecessary checks for v:sizeoflong in test_put.vim. They are no longer necessary as patch 8.2.3661 has changed the count to be within 32-bit integer limit. Solution: Remove the checks (zeertzjq). closes: vim/vim#15239 https://github.com/vim/vim/commit/69a28f6c0861523b1a9c565b3c882f439ae73ef4 --- test/old/testdir/test_put.vim | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_put.vim b/test/old/testdir/test_put.vim index 73b58dbe33..6b332faaeb 100644 --- a/test/old/testdir/test_put.vim +++ b/test/old/testdir/test_put.vim @@ -168,12 +168,6 @@ func Test_very_large_count() endfunc func Test_very_large_count_64bit() - throw 'Skipped: v:sizeoflong is N/A' " use legacy/put_spec.lua instead - - if v:sizeoflong < 8 - throw 'Skipped: only works with 64 bit long ints' - endif - new let @" = repeat('x', 100) call assert_fails('norm 999999999p', 'E1240:') @@ -190,12 +184,6 @@ func Test_very_large_count_block() endfunc func Test_very_large_count_block_64bit() - throw 'Skipped: v:sizeoflong is N/A' " use legacy/put_spec.lua instead - - if v:sizeoflong < 8 - throw 'Skipped: only works with 64 bit long ints' - endif - new call setline(1, repeat('x', 100)) exe "norm \$y" -- cgit From 6276fce11e1d1d344f988ebfc8857df7d4f1a8bd Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 13 Jul 2024 09:58:54 +0800 Subject: test(old): enable Test_address_line_overflow() Nvim doesn't use atol() in getdigits() and doesn't need to check for size of long. --- test/old/testdir/test_excmd.vim | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_excmd.vim b/test/old/testdir/test_excmd.vim index a9d7c27fe5..c8ddaa90fd 100644 --- a/test/old/testdir/test_excmd.vim +++ b/test/old/testdir/test_excmd.vim @@ -718,9 +718,7 @@ func Test_not_break_expression_register() endfunc func Test_address_line_overflow() - throw 'Skipped: v:sizeoflong is N/A' " use legacy/excmd_spec.lua instead - - if v:sizeoflong < 8 + if !has('nvim') && v:sizeoflong < 8 throw 'Skipped: only works with 64 bit long ints' endif new -- cgit From 5531c95101b7656416c97acdd4acb3173d09f64c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 14 Jul 2024 05:58:32 +0800 Subject: vim-patch:8.2.4065: computation overflow with large cound for :yank Problem: Computation overflow with large cound for :yank. Solution: Avoid an overflow. https://github.com/vim/vim/commit/3cf21b305104e91a28e4ce3a473672b2e88a9469 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_excmd.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_excmd.vim b/test/old/testdir/test_excmd.vim index c8ddaa90fd..d900207928 100644 --- a/test/old/testdir/test_excmd.vim +++ b/test/old/testdir/test_excmd.vim @@ -722,9 +722,14 @@ func Test_address_line_overflow() throw 'Skipped: only works with 64 bit long ints' endif new - call setline(1, 'text') + call setline(1, range(100)) call assert_fails('|.44444444444444444444444', 'E1247:') call assert_fails('|.9223372036854775806', 'E1247:') + + $ + yank 77777777777777777777 + call assert_equal("99\n", @") + bwipe! endfunc -- cgit From 3700d94c6fa3c6e2a58fc02414e4ca32b823214f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 14 Jul 2024 06:09:53 +0800 Subject: vim-patch:9.1.0579: Ex command is still executed after giving E1247 Problem: Ex command is still executed after giving E1247. Solution: Indicate the error properly and set cmd to NULL. (zeertzjq) closes: vim/vim#15241 https://github.com/vim/vim/commit/d1b5ea984d41102d253ecdd9a76124cd4c58b97d --- test/old/testdir/test_excmd.vim | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_excmd.vim b/test/old/testdir/test_excmd.vim index d900207928..50e5080f60 100644 --- a/test/old/testdir/test_excmd.vim +++ b/test/old/testdir/test_excmd.vim @@ -725,6 +725,8 @@ func Test_address_line_overflow() call setline(1, range(100)) call assert_fails('|.44444444444444444444444', 'E1247:') call assert_fails('|.9223372036854775806', 'E1247:') + call assert_fails('.44444444444444444444444d', 'E1247:') + call assert_equal(range(100)->map('string(v:val)'), getline(1, '$')) $ yank 77777777777777777777 -- cgit From 49ba36becd0bbf1052802b846f418aee673b28a5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 14 Jul 2024 06:50:36 +0800 Subject: vim-patch:9.1.0580: :lmap mapping for keypad key not applied when typed in Select mode (#29693) Problem: An :lmap mapping for a printable keypad key is not applied when typing it in Select mode. Solution: Change keypad key to ASCII after setting vgetc_char. (zeertzjq) closes: vim/vim#15245 https://github.com/vim/vim/commit/90a800274ded86d5d79dbea7ba647cd69b029b4e --- test/old/testdir/test_selectmode.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_selectmode.vim b/test/old/testdir/test_selectmode.vim index 59a1deba65..34ccdae7d8 100644 --- a/test/old/testdir/test_selectmode.vim +++ b/test/old/testdir/test_selectmode.vim @@ -323,4 +323,20 @@ func Test_ins_ctrl_o_in_insert_mode_resets_selectmode() bwipe! endfunc +" Test that an :lmap mapping for a printable keypad key is applied when typing +" it in Select mode. +func Test_selectmode_keypad_lmap() + new + lnoremap ??? + lnoremap !!! + setlocal iminsert=1 + call setline(1, 'abcdef') + call feedkeys("gH\\", 'tx') + call assert_equal(['???'], getline(1, '$')) + call feedkeys("gH\\", 'tx') + call assert_equal(['!!!'], getline(1, '$')) + + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 9093fbdd026f088d923fea374a96a8b01ca0df3a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 14 Jul 2024 06:38:26 +0800 Subject: vim-patch:9.1.0573: ex: no implicit print for single addresses Problem: ex: no implicit print for single addresses Solution: explicitly print even during single addresses, as requested by POSIX (Mohamed Akram) See the POSIX behaviour here: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ex.html#tag_20_40_13_03 Section 6b closes: vim/vim#15230 https://github.com/vim/vim/commit/c25a7084e9ae1f78c28ddcbe1fa23374cfdf1e03 Co-authored-by: Mohamed Akram --- test/old/testdir/setup.vim | 19 +++++++++++++++++-- test/old/testdir/test_ex_mode.vim | 11 +++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/setup.vim b/test/old/testdir/setup.vim index 2e4085ce03..6f400c5e32 100644 --- a/test/old/testdir/setup.vim +++ b/test/old/testdir/setup.vim @@ -32,8 +32,8 @@ if exists('s:did_load') endif if g:testname !~ 'test_mapping.vim$' " Make "Q" switch to Ex mode. - " This does not work for all tests. - nnoremap Q gQ + " This does not work for all tests as Nvim only supports Vim Ex mode. + nnoremap Q gQcallExStart() endif endif @@ -45,6 +45,21 @@ if exists('s:did_load') endif let s:did_load = 1 +func s:ExStart() + call feedkeys($"\call{expand('')}ExMayEnd()\") +endfunc + +func s:ExMayEnd() + " When :normal runs out of characters in Vim, the behavior is different in + " normal Ex mode vs. Vim Ex mode. + " - In normal Ex mode, "\n" is used. + " - In Vim Ex mode, Ctrl-C is used. + " Nvim only supports Vim Ex mode, so emulate the normal Ex mode behavior. + if state('m') == '' && mode(1) == 'cv' && getcharstr(1) == "\" + call feedkeys("\n") + endif +endfunc + " Clear Nvim default user commands, mappings and menus. comclear mapclear diff --git a/test/old/testdir/test_ex_mode.vim b/test/old/testdir/test_ex_mode.vim index 42f08868a0..31615ec47d 100644 --- a/test/old/testdir/test_ex_mode.vim +++ b/test/old/testdir/test_ex_mode.vim @@ -282,4 +282,15 @@ func Test_ex_mode_large_indent() endfunc +" Testing implicit print command +func Test_implicit_print() + new + call setline(1, ['one', 'two', 'three']) + call feedkeys('Q:let a=execute(":1,2")', 'xt') + call feedkeys('Q:let b=execute(":3")', 'xt') + call assert_equal('one two', a->split('\n')->join(' ')) + call assert_equal('three', b->split('\n')->join(' ')) + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From ba36742211eea55bed2ffbca129a45023967f204 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 14 Jul 2024 08:17:49 +0800 Subject: vim-patch:9.1.0574: ex: wrong handling of commands after bar Problem: ex: wrong handling of commands after bar Solution: for :append, :insert and :change use the text after the bar as input for those commands. This is what POSIX requests. (Mohamed Akram) See the POSIX Spec: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ex.html#tag_20_40_13_03 Section 12.c closes: vim/vim#15229 https://github.com/vim/vim/commit/8c446da34998f6350911e07fbfd7932412c83185 Co-authored-by: Mohamed Akram --- test/old/testdir/test_ex_mode.vim | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ex_mode.vim b/test/old/testdir/test_ex_mode.vim index 31615ec47d..622a591c98 100644 --- a/test/old/testdir/test_ex_mode.vim +++ b/test/old/testdir/test_ex_mode.vim @@ -293,4 +293,12 @@ func Test_implicit_print() bw! endfunc +" Test inserting text after the trailing bar +func Test_insert_after_trailing_bar() + new + call feedkeys("Qi|\nfoo\n.\na|bar\nbar\n.\nc|baz\n.", "xt") + call assert_equal(['', 'foo', 'bar', 'baz'], getline(1, '$')) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From c8401515cdaad20220e30f5a0c39ddb7bae77f5e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 14 Jul 2024 16:28:05 +0800 Subject: vim-patch:9.1.0582: Printed line doesn't overwrite colon when pressing Enter in Ex mode Problem: Printed line no longer overwrites colon when pressing Enter in Ex mode (after 9.1.0573). Solution: Restore the behavior of pressing Enter in Ex mode. (zeertzjq) closes: vim/vim#15258 https://github.com/vim/vim/commit/7d664bf0eb2cb25cb77933c8b7f11ca09929e7b8 --- test/old/testdir/test_ex_mode.vim | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ex_mode.vim b/test/old/testdir/test_ex_mode.vim index 622a591c98..f55ba87a3e 100644 --- a/test/old/testdir/test_ex_mode.vim +++ b/test/old/testdir/test_ex_mode.vim @@ -69,7 +69,7 @@ func Test_Ex_substitute() CheckRunVimInTerminal let buf = RunVimInTerminal('', {'rows': 6}) - call term_sendkeys(buf, ":call setline(1, ['foo foo', 'foo foo', 'foo foo'])\") + call term_sendkeys(buf, ":call setline(1, repeat(['foo foo'], 4))\") call term_sendkeys(buf, ":set number\") call term_sendkeys(buf, "gQ") call WaitForAssert({-> assert_match(':', term_getline(buf, 6))}, 1000) @@ -91,8 +91,14 @@ func Test_Ex_substitute() " Pressing enter in ex mode should print the current line call term_sendkeys(buf, "\") - call WaitForAssert({-> assert_match(' 3 foo foo', - \ term_getline(buf, 5))}, 1000) + call WaitForAssert({-> assert_match(' 3 foo foo', term_getline(buf, 5))}, 1000) + call WaitForAssert({-> assert_match(':', term_getline(buf, 6))}, 1000) + + " The printed line should overwrite the colon + call term_sendkeys(buf, "\") + call WaitForAssert({-> assert_match(' 3 foo foo', term_getline(buf, 4))}, 1000) + call WaitForAssert({-> assert_match(' 4 foo foo', term_getline(buf, 5))}, 1000) + call WaitForAssert({-> assert_match(':', term_getline(buf, 6))}, 1000) call term_sendkeys(buf, ":vi\") call WaitForAssert({-> assert_match('foo bar', term_getline(buf, 1))}, 1000) -- cgit From 60734dc76112c4142c6048839a0b93c2d48e77f3 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 14 Jul 2024 12:02:40 +0200 Subject: vim-patch:9.1.0583: filetype: *.pdf_tex files are not recognized Problem: filetype: *.pdf_tex files are not recognized Solution: Detect '*.pdf_tex' files as tex filetype (Jonas Dujava) Those files are generated by inkscape, when exporting, see e.g. https://inkscape.org/doc/inkscape-man.html closes: vim/vim#15250 https://github.com/vim/vim/commit/28145e005d646cb0477aa26ef69d0f651a9f9d27 Co-authored-by: Jonas Dujava --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index a6df28696c..b30102ce11 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -764,7 +764,7 @@ func s:GetFilenameChecks() abort \ 'teraterm': ['file.ttl'], \ 'terminfo': ['file.ti'], \ 'terraform-vars': ['file.tfvars'], - \ 'tex': ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl', 'any/.texlive/texmf-config/tex/latex/file/file.cfg', 'file.pgf', 'file.nlo', 'file.nls', 'file.thm', 'file.eps_tex', 'file.pygtex', 'file.pygstyle', 'file.clo', 'file.aux', 'file.brf', 'file.ind', 'file.lof', 'file.loe', 'file.nav', 'file.vrb', 'file.ins', 'file.tikz', 'file.bbx', 'file.cbx', 'file.beamer'], + \ 'tex': ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl', 'any/.texlive/texmf-config/tex/latex/file/file.cfg', 'file.pgf', 'file.nlo', 'file.nls', 'file.thm', 'file.eps_tex', 'file.pygtex', 'file.pygstyle', 'file.clo', 'file.aux', 'file.brf', 'file.ind', 'file.lof', 'file.loe', 'file.nav', 'file.vrb', 'file.ins', 'file.tikz', 'file.bbx', 'file.cbx', 'file.beamer', 'file.pdf_tex'], \ 'texinfo': ['file.texinfo', 'file.texi', 'file.txi'], \ 'texmf': ['texmf.cnf'], \ 'text': ['file.text', 'file.txt', 'README', 'LICENSE', 'COPYING', 'AUTHORS', '/usr/share/doc/bash-completion/AUTHORS', '/etc/apt/apt.conf.d/README', '/etc/Muttrc.d/README'], -- cgit From 79130c0fd393e3eef8e4c939c54ea3d3faec2149 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 14 Jul 2024 17:26:40 +0200 Subject: vim-patch:9.1.0586: ocaml runtime files are outdated Problem: ocaml runtime files are outdated Solution: sync those files with the upstream repo, detect a few more ocaml files (Yinzuo Jiang) closes: vim/vim#15260 https://github.com/vim/vim/commit/700cf8cfa1e926e2ba676203b3ad90c2c2083f1d Co-authored-by: Yinzuo Jiang --- test/old/testdir/test_filetype.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index b30102ce11..d6518c46c7 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -229,7 +229,7 @@ func s:GetFilenameChecks() abort \ 'dtd': ['file.dtd'], \ 'dtrace': ['/usr/lib/dtrace/io.d'], \ 'dts': ['file.dts', 'file.dtsi', 'file.dtso', 'file.its', 'file.keymap'], - \ 'dune': ['jbuild', 'dune', 'dune-project', 'dune-workspace'], + \ 'dune': ['jbuild', 'dune', 'dune-project', 'dune-workspace', 'dune-file'], \ 'dylan': ['file.dylan'], \ 'dylanintr': ['file.intr'], \ 'dylanlid': ['file.lid'], @@ -527,7 +527,7 @@ func s:GetFilenameChecks() abort \ 'odin': ['file.odin'], \ 'omnimark': ['file.xom', 'file.xin'], \ 'ondir': ['.ondirrc'], - \ 'opam': ['opam', 'file.opam', 'file.opam.template'], + \ 'opam': ['opam', 'file.opam', 'file.opam.template', 'opam.locked', 'file.opam.locked'], \ 'openroad': ['file.or'], \ 'openscad': ['file.scad'], \ 'openvpn': ['file.ovpn', '/etc/openvpn/client/client.conf', '/usr/share/openvpn/examples/server.conf'], -- cgit From 7214fd8f557251745c7499c1f273e3e2871fc060 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 15 Jul 2024 05:57:35 +0800 Subject: vim-patch:partial:9.0.0418: manually deleting temp test files Problem: Manually deleting temp test files. Solution: Use the 'D' flag of writefile() and mkdir(). https://github.com/vim/vim/commit/45bbaef0382c5468d9fac511775bd99ea7bf5b84 This only includes test_cpoptions.vim changes. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_cpoptions.vim | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cpoptions.vim b/test/old/testdir/test_cpoptions.vim index 915f418712..8512edf2e6 100644 --- a/test/old/testdir/test_cpoptions.vim +++ b/test/old/testdir/test_cpoptions.vim @@ -8,7 +8,7 @@ source view_util.vim " file name. func Test_cpo_a() let save_cpo = &cpo - call writefile(['one'], 'XfileCpoA') + call writefile(['one'], 'XfileCpoA', 'D') " Wipe out all the buffers, so that the alternate file is empty edit Xfoo | %bw set cpo-=a @@ -20,7 +20,6 @@ func Test_cpo_a() read XfileCpoA call assert_equal('XfileCpoA', @#) close! - call delete('XfileCpoA') let &cpo = save_cpo endfunc @@ -104,21 +103,20 @@ endfunc " Test for the 'C' flag in 'cpo' (line continuation) func Test_cpo_C() let save_cpo = &cpo - call writefile(['let l = [', '\ 1,', '\ 2]'], 'XfileCpoC') + call writefile(['let l = [', '\ 1,', '\ 2]'], 'XfileCpoC', 'D') set cpo-=C source XfileCpoC call assert_equal([1, 2], g:l) set cpo+=C call assert_fails('source XfileCpoC', ['E697:', 'E10:']) - call delete('XfileCpoC') let &cpo = save_cpo endfunc " Test for the 'd' flag in 'cpo' (tags relative to the current file) func Test_cpo_d() let save_cpo = &cpo - call mkdir('XdirCpoD') - call writefile(["one\tXfile1\t/^one$/"], 'tags') + call mkdir('XdirCpoD', 'R') + call writefile(["one\tXfile1\t/^one$/"], 'tags', 'D') call writefile(["two\tXfile2\t/^two$/"], 'XdirCpoD/tags') set tags=./tags set cpo-=d @@ -126,9 +124,8 @@ func Test_cpo_d() call assert_equal('two', taglist('.*')[0].name) set cpo+=d call assert_equal('one', taglist('.*')[0].name) + %bw! - call delete('tags') - call delete('XdirCpoD', 'rf') set tags& let &cpo = save_cpo endfunc @@ -423,14 +420,13 @@ func Test_cpo_O() let save_cpo = &cpo new XfileCpoO call setline(1, 'one') - call writefile(['two'], 'XfileCpoO') + call writefile(['two'], 'XfileCpoO', 'D') set cpo-=O call assert_fails('write', 'E13:') set cpo+=O write call assert_equal(['one'], readfile('XfileCpoO')) close! - call delete('XfileCpoO') let &cpo = save_cpo endfunc @@ -440,7 +436,7 @@ endfunc " name) func Test_cpo_P() let save_cpo = &cpo - call writefile([], 'XfileCpoP') + call writefile([], 'XfileCpoP', 'D') new call setline(1, 'one') set cpo+=F @@ -452,7 +448,6 @@ func Test_cpo_P() call assert_equal('XfileCpoP', @%) bwipe! - call delete('XfileCpoP') let &cpo = save_cpo endfunc @@ -645,7 +640,7 @@ endfunc " Test for the 'Z' flag in 'cpo' (write! resets 'readonly') func Test_cpo_Z() let save_cpo = &cpo - call writefile([], 'XfileCpoZ') + call writefile([], 'XfileCpoZ', 'D') new XfileCpoZ setlocal readonly set cpo-=Z @@ -656,7 +651,6 @@ func Test_cpo_Z() write! call assert_equal(1, &readonly) close! - call delete('XfileCpoZ') let &cpo = save_cpo endfunc @@ -735,7 +729,7 @@ endfunc " flag) func Test_cpo_plus() let save_cpo = &cpo - call writefile([], 'XfileCpoPlus') + call writefile([], 'XfileCpoPlus', 'D') new XfileCpoPlus call setline(1, 'foo') write X1 @@ -744,7 +738,6 @@ func Test_cpo_plus() write X2 call assert_equal(0, &modified) close! - call delete('XfileCpoPlus') call delete('X1') call delete('X2') let &cpo = save_cpo @@ -850,7 +843,7 @@ endfunc " loaded and ':preserve' is used. func Test_cpo_ampersand() throw 'Skipped: Nvim does not support cpoptions flag "&"' - call writefile(['one'], 'XfileCpoAmp') + call writefile(['one'], 'XfileCpoAmp', 'D') let after =<< trim [CODE] set cpo+=& preserve @@ -860,7 +853,6 @@ func Test_cpo_ampersand() call assert_equal(1, filereadable('.XfileCpoAmp.swp')) call delete('.XfileCpoAmp.swp') endif - call delete('XfileCpoAmp') endfunc " Test for the '\' flag in 'cpo' (backslash in a [] range in a search pattern) -- cgit From 15a0977ffc1499fd513135d39845f67111e51ac2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 15 Jul 2024 05:57:29 +0800 Subject: vim-patch:9.1.0585: tests: test_cpoptions leaves swapfiles around Problem: tests: test_cpoptions leaves swapfiles around Solution: Use :bw! instead of :close! https://github.com/vim/vim/commit/bb5d27dc79187ff3bd51734946a4c8418989a218 Co-authored-by: Christian Brabandt --- test/old/testdir/test_cpoptions.vim | 74 ++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cpoptions.vim b/test/old/testdir/test_cpoptions.vim index 8512edf2e6..dd959c64a8 100644 --- a/test/old/testdir/test_cpoptions.vim +++ b/test/old/testdir/test_cpoptions.vim @@ -19,7 +19,7 @@ func Test_cpo_a() set cpo+=a read XfileCpoA call assert_equal('XfileCpoA', @#) - close! + bw! let &cpo = save_cpo endfunc @@ -39,7 +39,7 @@ func Test_cpo_A() set cpo+=A write XcpoAfile2 call assert_equal('XcpoAfile2', @#) - close! + bw! call delete('XcpoAfile2') let &cpo = save_cpo endfunc @@ -81,7 +81,7 @@ func Test_cpo_B() call assert_equal('abd ', getline(1)) call feedkeys(":imap x\\\"\", 'tx') call assert_equal('"imap x\k', @:) - close! + bw! let &cpo = save_cpo endfunc @@ -96,7 +96,7 @@ func Test_cpo_c() set cpo-=c exe "normal gg/abab\" call assert_equal(5, searchcount().total) - close! + bw! let &cpo = save_cpo endfunc @@ -143,7 +143,7 @@ func Test_cpo_D() exe "norm! 1gg0f\!!" call assert_equal(1, col('.')) set cpo-=D - close! + bw! let &cpo = save_cpo endfunc @@ -183,7 +183,7 @@ func Test_cpo_E() call assert_beeps('exe "normal v\"') call assert_beeps('exe "normal v\"') set cpo-=E - close! + bw! endfunc " Test for the 'f' flag in 'cpo' (read in an empty buffer sets the file name) @@ -213,7 +213,7 @@ func Test_cpo_F() set cpo+=F write XfileCpoF call assert_equal('XfileCpoF', @%) - close! + bw! call delete('XfileCpoF') let &cpo = save_cpo endfunc @@ -230,7 +230,7 @@ func Test_cpo_g() " set cpo+=g " edit " call assert_equal(1, line('.')) - close! + bw! let &cpo = save_cpo endfunc @@ -247,7 +247,7 @@ func Test_cpo_H() " call setline(1, ' ') " normal! Ia " call assert_equal(' a ', getline(1)) - close! + bw! let &cpo = save_cpo endfunc @@ -266,7 +266,7 @@ func Test_cpo_I() %d exe "normal i one\\" call assert_equal('', getline(2)) - close! + bw! let &cpo = save_cpo endfunc @@ -297,7 +297,7 @@ func Test_cpo_J() normal ( call assert_equal(colnr, col('.')) endfor - close! + bw! let &cpo = save_cpo endfunc @@ -319,7 +319,7 @@ func Test_cpo_l() set cpo+=l exe 'normal gg/[\t]' .. "\" call assert_equal([4, 10], [col('.'), virtcol('.')]) - close! + bw! let &cpo = save_cpo endfunc @@ -340,7 +340,7 @@ func Test_cpo_L() call setline(1, 'abcdefghijklmnopqr') exe "normal 0gR\" call assert_equal("\ijklmnopqr", getline(1)) - close! + bw! let &cpo = save_cpo endfunc @@ -378,7 +378,7 @@ func Test_cpo_M() call cursor(2, 1) call assert_beeps('normal %') - close! + bw! let &cpo = save_cpo endfunc @@ -394,7 +394,7 @@ func Test_cpo_n() set cpo+=n redraw! call assert_equal('aaaa', Screenline(2)) - close! + bw! let &cpo = save_cpo endfunc @@ -411,7 +411,7 @@ func Test_cpo_o() exe "normal /one/+2\" normal n call assert_equal(5, line('.')) - close! + bw! let &cpo = save_cpo endfunc @@ -426,7 +426,7 @@ func Test_cpo_O() set cpo+=O write call assert_equal(['one'], readfile('XfileCpoO')) - close! + bw! let &cpo = save_cpo endfunc @@ -464,7 +464,7 @@ func Test_cpo_q() set cpo+=q normal gg4J call assert_equal(4, col('.')) - close! + bw! let &cpo = save_cpo endfunc @@ -485,7 +485,7 @@ func Test_cpo_r() let @/ = 'three' normal 2G. call assert_equal('abc three four', getline(2)) - close! + bw! let &cpo = save_cpo endfunc @@ -505,7 +505,7 @@ func Test_cpo_R() 3mark r %!sort call assert_equal(0, line("'r")) - close! + bw! let &cpo = save_cpo endfunc @@ -532,8 +532,8 @@ func Test_cpo_S() wincmd p call assert_equal(0, &autoindent) wincmd t - close! - close! + bw! + bw! let &cpo = save_cpo endfunc @@ -552,7 +552,7 @@ func Test_cpo_u() exe "normal iabc\udef\ughi" normal uu call assert_equal('abcdefghi', getline(1)) - close! + bw! let &cpo = save_cpo endfunc @@ -577,7 +577,7 @@ func Test_cpo_w() call assert_equal('hereZZZare some words', getline('.')) norm! 1gg2elcWYYY call assert_equal('hereZZZare someYYYwords', getline('.')) - close! + bw! let &cpo = save_cpo endfunc @@ -614,7 +614,7 @@ func Test_cpo_X() normal ggRy normal 4. call assert_equal('yyyyxxxaaaaa', getline(1)) - close! + bw! let &cpo = save_cpo endfunc @@ -633,7 +633,7 @@ func Test_cpo_y() normal ggyy normal 2G. call assert_equal("two\n", @") - close! + bw! let &cpo = save_cpo endfunc @@ -650,7 +650,7 @@ func Test_cpo_Z() setlocal readonly write! call assert_equal(1, &readonly) - close! + bw! let &cpo = save_cpo endfunc @@ -704,7 +704,7 @@ func Test_cpo_percent() call assert_equal(15, col('.')) normal 22|% call assert_equal(27, col('.')) - close! + bw! let &cpo = save_cpo endfunc @@ -721,7 +721,7 @@ func Test_cpo_minus() call assert_beeps('normal 10k') call assert_equal(3, line('.')) call assert_fails(10, 'E16:') - close! + bw! let &cpo = save_cpo endfunc @@ -737,7 +737,7 @@ func Test_cpo_plus() set cpo+=+ write X2 call assert_equal(0, &modified) - close! + bw! call delete('X1') call delete('X2') let &cpo = save_cpo @@ -755,7 +755,7 @@ func Test_cpo_star() " set cpo+=* " *a " call assert_equal(1, x) - close! + bw! let &cpo = save_cpo endfunc @@ -776,7 +776,7 @@ func Test_cpo_gt() normal gg"Rye normal "Rye call assert_equal("\none\none", @r) - close! + bw! let &cpo = save_cpo endfunc @@ -809,7 +809,7 @@ func Test_cpo_semicolon() call assert_equal('bbb y', getline(4)) call assert_equal('ccc', getline(5)) call assert_equal('ddd yee y', getline(6)) - close! + bw! let &cpo = save_cpo endfunc @@ -835,7 +835,7 @@ func Test_cpo_hash() " call assert_equal(['', 'one', 'two', 'three'], getline(1, '$')) " normal gg2Ozero " call assert_equal(['zero', '', 'one', 'two', 'three'], getline(1, '$')) - close! + bw! let &cpo = save_cpo endfunc @@ -867,7 +867,7 @@ func Test_cpo_backslash() " set cpo+=\ " exe 'normal gg/[ \-]' .. "\n" " call assert_equal(2, col('.')) - close! + bw! let &cpo = save_cpo endfunc @@ -890,7 +890,7 @@ func Test_cpo_brace() " call assert_equal(2, line('.')) " normal G{ " call assert_equal(2, line('.')) - close! + bw! let &cpo = save_cpo endfunc @@ -919,7 +919,7 @@ func Test_cpo_dot() call delete('Xfoo') set cpo& - close! + bw! let &cpo = save_cpo endfunc -- cgit From 1bf9a7ce950c2e15d9d005aeebc33b0261798372 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 16 Jul 2024 10:54:53 +0800 Subject: vim-patch:8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow Problem: Vim9: check for DO_NOT_FREE_CNT is very slow. Solution: Move to a separate function so it can be skipped by setting $TEST_SKIP_PAT. https://github.com/vim/vim/commit/dae453f3397a26a53301d7327e6ed43e8b392035 Co-authored-by: Bram Moolenaar --- test/old/testdir/runtest.vim | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/runtest.vim b/test/old/testdir/runtest.vim index a1d4011d7e..53ad20dc6f 100644 --- a/test/old/testdir/runtest.vim +++ b/test/old/testdir/runtest.vim @@ -13,6 +13,9 @@ " For csh: " setenv TEST_FILTER Test_channel " +" If the environment variable $TEST_SKIP_PAT is set then test functions +" matching this pattern will be skipped. It's the opposite of $TEST_FILTER. +" " While working on a test you can make $TEST_NO_RETRY non-empty to not retry: " export TEST_NO_RETRY=yes " @@ -431,13 +434,17 @@ func FinishTesting() if s:done == 0 if s:filtered > 0 - let message = "NO tests match $TEST_FILTER: '" .. $TEST_FILTER .. "'" + if $TEST_FILTER != '' + let message = "NO tests match $TEST_FILTER: '" .. $TEST_FILTER .. "'" + else + let message = "ALL tests match $TEST_SKIP_PAT: '" .. $TEST_SKIP_PAT .. "'" + endif else let message = 'NO tests executed' endif else if s:filtered > 0 - call add(s:messages, "Filtered " .. s:filtered .. " tests with $TEST_FILTER") + call add(s:messages, "Filtered " .. s:filtered .. " tests with $TEST_FILTER and $TEST_SKIP_PAT") endif let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test') endif @@ -530,6 +537,12 @@ endif " Execute the tests in alphabetical order. for g:testfunc in sort(s:tests) + if $TEST_SKIP_PAT != '' && g:testfunc =~ $TEST_SKIP_PAT + call add(s:messages, g:testfunc .. ' matches $TEST_SKIP_PAT') + let s:filtered += 1 + continue + endif + " Silence, please! set belloff=all let prev_error = '' -- cgit From 24bd7a4a9c2b13345c1f68f3604c1fd085eb9fa4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 16 Jul 2024 10:53:54 +0800 Subject: vim-patch:8.2.3579: CI sometimes fails for MinGW Problem: CI sometimes fails for MinGW. Solution: Use backslashes in HandleSwapExists(). (Christian Brabandt, closes vim/vim#9078) https://github.com/vim/vim/commit/4b2c8047679b737dcb0cd15c313ee51553aed617 Co-authored-by: Christian Brabandt --- test/old/testdir/runtest.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/runtest.vim b/test/old/testdir/runtest.vim index 53ad20dc6f..362964c5cb 100644 --- a/test/old/testdir/runtest.vim +++ b/test/old/testdir/runtest.vim @@ -95,7 +95,12 @@ set encoding=utf-8 " REDIR_TEST_TO_NULL has a very permissive SwapExists autocommand which is for " the test_name.vim file itself. Replace it here with a more restrictive one, " so we still catch mistakes. -let s:test_script_fname = expand('%') +if has("win32") + " replace any '/' directory separators by '\\' + let s:test_script_fname = substitute(expand('%'), '/', '\\', 'g') +else + let s:test_script_fname = expand('%') +endif au! SwapExists * call HandleSwapExists() func HandleSwapExists() if exists('g:ignoreSwapExists') -- cgit From a553b3687668d055e4c2703fce2aea3ae1140374 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 16 Jul 2024 11:44:17 +0800 Subject: vim-patch:7.4.1565 (#29734) Problem: Crash when assert_equal() runs into a NULL string. Solution: Check for NULL. (Dominique) Add a test. https://github.com/vim/vim/commit/f1551964448607f8222de2d8f0992ea43eb2fe67 Use the latest version of the test from Vim. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_assert.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_assert.vim b/test/old/testdir/test_assert.vim index fe093d3582..bc79ef9296 100644 --- a/test/old/testdir/test_assert.vim +++ b/test/old/testdir/test_assert.vim @@ -189,6 +189,22 @@ func Test_wrong_error_type() call assert_equal(type([]), type(verrors)) endfunc +func Test_compare_fail() + let s:v = {} + let s:x = {"a": s:v} + let s:v["b"] = s:x + let s:w = {"c": s:x, "d": ''} + try + call assert_equal(s:w, '') + catch + call assert_equal(0, assert_exception('E724:')) + " Nvim: expected value isn't shown as NULL + " call assert_match("Expected NULL but got ''", v:errors[0]) + call assert_match("Expected .* but got ''", v:errors[0]) + call remove(v:errors, 0) + endtry +endfunc + func Test_match() call assert_equal(0, assert_match('^f.*b.*r$', 'foobar')) -- cgit From 37c7c7547a09cb6fb391f739d08290b782429494 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 16 Jul 2024 13:39:20 +0800 Subject: vim-patch:8.1.1106: no test for 'writedelay' (#29736) Problem: No test for 'writedelay'. Solution: Add a test. https://github.com/vim/vim/commit/449ac47f931c99188575037ddfc5ee96f5200d2f Co-authored-by: Bram Moolenaar --- test/old/testdir/test_options.vim | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index 26b4f64487..d0ae33605b 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -1367,6 +1367,31 @@ func Test_local_scrolloff() set siso& endfunc +func Test_writedelay() + CheckFunction reltimefloat + + new + call setline(1, 'empty') + " Nvim: 'writedelay' is applied per screen line. + " Create 7 vertical splits first. + vs | vs | vs | vs | vs | vs + redraw + set writedelay=10 + let start = reltime() + " call setline(1, repeat('x', 70)) + " Nvim: enable 'writedelay' per screen line. + " In each of the 7 vertical splits, 10 screen lines need to be drawn. + set redrawdebug+=line + call setline(1, repeat(['x'], 10)) + redraw + let elapsed = reltimefloat(reltime(start)) + set writedelay=0 + " With 'writedelay' set should take at least 30 * 10 msec + call assert_inrange(30 * 0.01, 999.0, elapsed) + + bwipe! +endfunc + func Test_visualbell() set belloff= set visualbell -- cgit From 598fd77d952364d4dd3433425afe9798dac15206 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 16 Jul 2024 14:25:35 +0800 Subject: vim-patch:8.2.0183: tests fail when the float feature is disabled (#29738) Problem: Tests fail when the float feature is disabled. Solution: Skip tests that don't work without float support. https://github.com/vim/vim/commit/5feabe00c47fa66d5f4c95213f150488433f78e3 Cherry-pick Test_ruby_Vim_blob() from patch 8.1.0977 and skip it. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_lambda.vim | 4 +++- test/old/testdir/test_ruby.vim | 8 ++++++++ test/old/testdir/test_sort.vim | 28 ++++++++++++++++++++++++++++ test/old/testdir/test_vimscript.vim | 32 +++++++++++++++++++++++--------- 4 files changed, 62 insertions(+), 10 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_lambda.vim b/test/old/testdir/test_lambda.vim index 810b41b389..0340a7260b 100644 --- a/test/old/testdir/test_lambda.vim +++ b/test/old/testdir/test_lambda.vim @@ -217,7 +217,9 @@ endfunc func Test_lambda_combination() call assert_equal(2, {x -> {x -> x}}(1)(2)) call assert_equal(10, {y -> {x -> x(y)(10)}({y -> y})}({z -> z})) - call assert_equal(5.0, {x -> {y -> x / y}}(10)(2.0)) + if has('float') + call assert_equal(5.0, {x -> {y -> x / y}}(10)(2.0)) + endif call assert_equal(6, {x -> {y -> {z -> x + y + z}}}(1)(2)(3)) call assert_equal(6, {x -> {f -> f(x)}}(3)({x -> x * 2})) diff --git a/test/old/testdir/test_ruby.vim b/test/old/testdir/test_ruby.vim index 4929496086..483e235636 100644 --- a/test/old/testdir/test_ruby.vim +++ b/test/old/testdir/test_ruby.vim @@ -337,6 +337,14 @@ func Test_ruby_Vim_evaluate() call assert_equal('FalseClass',rubyeval('Vim::evaluate("v:false").class')) endfunc +func Test_ruby_Vim_blob() + throw 'skipped: TODO: ' + call assert_equal('0z', rubyeval('Vim::blob("")')) + call assert_equal('0z31326162', rubyeval('Vim::blob("12ab")')) + call assert_equal('0z00010203', rubyeval('Vim::blob("\x00\x01\x02\x03")')) + call assert_equal('0z8081FEFF', rubyeval('Vim::blob("\x80\x81\xfe\xff")')) +endfunc + func Test_ruby_Vim_evaluate_list() call setline(line('$'), ['2 line 2']) ruby Vim.command("normal /^2\n") diff --git a/test/old/testdir/test_sort.vim b/test/old/testdir/test_sort.vim index 94a35e3cb5..dafa3f618f 100644 --- a/test/old/testdir/test_sort.vim +++ b/test/old/testdir/test_sort.vim @@ -1336,6 +1336,34 @@ func Test_sort_cmd() \ ] endif endif + if has('float') + let tests += [ + \ { + \ 'name' : 'float', + \ 'cmd' : 'sort f', + \ 'input' : [ + \ '1.234', + \ '0.88', + \ ' + 123.456', + \ '1.15e-6', + \ '-1.1e3', + \ '-1.01e3', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ '', + \ '', + \ '-1.1e3', + \ '-1.01e3', + \ '1.15e-6', + \ '0.88', + \ '1.234', + \ ' + 123.456' + \ ] + \ }, + \ ] + endif for t in tests enew! diff --git a/test/old/testdir/test_vimscript.vim b/test/old/testdir/test_vimscript.vim index 1012aca54d..28868a07d6 100644 --- a/test/old/testdir/test_vimscript.vim +++ b/test/old/testdir/test_vimscript.vim @@ -6502,16 +6502,22 @@ func Test_type() call assert_equal(2, type(function("tr", [8]))) call assert_equal(3, type([])) call assert_equal(4, type({})) - call assert_equal(5, type(0.0)) + if has('float') + call assert_equal(5, type(0.0)) + endif call assert_equal(6, type(v:false)) call assert_equal(6, type(v:true)) + " call assert_equal(7, type(v:none)) call assert_equal(7, type(v:null)) call assert_equal(v:t_number, type(0)) call assert_equal(v:t_string, type("")) call assert_equal(v:t_func, type(function("tr"))) + call assert_equal(v:t_func, type(function("tr", [8]))) call assert_equal(v:t_list, type([])) call assert_equal(v:t_dict, type({})) - call assert_equal(v:t_float, type(0.0)) + if has('float') + call assert_equal(v:t_float, type(0.0)) + endif call assert_equal(v:t_bool, type(v:false)) call assert_equal(v:t_bool, type(v:true)) " call assert_equal(v:t_none, type(v:none)) @@ -6829,10 +6835,12 @@ func Test_bitwise_functions() call assert_equal(16, and(127, 16)) eval 127->and(16)->assert_equal(16) call assert_equal(0, and(127, 128)) - call assert_fails("call and(1.0, 1)", 'E805:') call assert_fails("call and([], 1)", 'E745:') call assert_fails("call and({}, 1)", 'E728:') - call assert_fails("call and(1, 1.0)", 'E805:') + if has('float') + call assert_fails("call and(1.0, 1)", 'E805:') + call assert_fails("call and(1, 1.0)", 'E805:') + endif call assert_fails("call and(1, [])", 'E745:') call assert_fails("call and(1, {})", 'E728:') " or @@ -6840,10 +6848,12 @@ func Test_bitwise_functions() call assert_equal(15, or(8, 7)) eval 8->or(7)->assert_equal(15) call assert_equal(123, or(0, 123)) - call assert_fails("call or(1.0, 1)", 'E805:') call assert_fails("call or([], 1)", 'E745:') call assert_fails("call or({}, 1)", 'E728:') - call assert_fails("call or(1, 1.0)", 'E805:') + if has('float') + call assert_fails("call or(1.0, 1)", 'E805:') + call assert_fails("call or(1, 1.0)", 'E805:') + endif call assert_fails("call or(1, [])", 'E745:') call assert_fails("call or(1, {})", 'E728:') " xor @@ -6851,10 +6861,12 @@ func Test_bitwise_functions() call assert_equal(111, xor(127, 16)) eval 127->xor(16)->assert_equal(111) call assert_equal(255, xor(127, 128)) - call assert_fails("call xor(1.0, 1)", 'E805:') + if has('float') + call assert_fails("call xor(1.0, 1)", 'E805:') + call assert_fails("call xor(1, 1.0)", 'E805:') + endif call assert_fails("call xor([], 1)", 'E745:') call assert_fails("call xor({}, 1)", 'E728:') - call assert_fails("call xor(1, 1.0)", 'E805:') call assert_fails("call xor(1, [])", 'E745:') call assert_fails("call xor(1, {})", 'E728:') " invert @@ -6862,7 +6874,9 @@ func Test_bitwise_functions() eval 127->invert()->and(65535)->assert_equal(65408) call assert_equal(65519, and(invert(16), 65535)) call assert_equal(65407, and(invert(128), 65535)) - call assert_fails("call invert(1.0)", 'E805:') + if has('float') + call assert_fails("call invert(1.0)", 'E805:') + endif call assert_fails("call invert([])", 'E745:') call assert_fails("call invert({})", 'E728:') endfunc -- cgit From 76aede11622aa790cbe5de629b0fb9c9fe2770ab Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 16 Jul 2024 14:36:18 +0800 Subject: vim-patch:8.2.2276: list of distributed files is outdated Problem: List of distributed files is outdated. Solution: Update the file list. Minor comment updates. https://github.com/vim/vim/commit/a72514945bc3edd4fc4d745004e37c5d5487c98d Co-authored-by: Bram Moolenaar --- test/old/testdir/test_signals.vim | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_signals.vim b/test/old/testdir/test_signals.vim index 667448a7c2..2f9b6c09d8 100644 --- a/test/old/testdir/test_signals.vim +++ b/test/old/testdir/test_signals.vim @@ -86,8 +86,8 @@ func Test_signal_INT() throw 'Skipped: INT signal not supported' endif - " Skip the rest of the test when running with valgrind as signal INT is not - " received somehow by Vim when running with valgrind. + " Skip the test when running with valgrind as signal INT is not received + " somehow by Vim when running with valgrind. let cmd = GetVimCommand() if cmd =~ 'valgrind' throw 'Skipped: cannot test signal INT with valgrind' @@ -120,10 +120,6 @@ func Test_deadly_signal_TERM() throw 'Skipped: TERM signal not supported' endif CheckRunVimInTerminal - let cmd = GetVimCommand() - if cmd =~ 'valgrind' - throw 'Skipped: cannot test signal TERM with valgrind' - endif " If test fails once, it can leave temporary files and trying to rerun " the test would then fail again if they are not deleted first. -- cgit From a35eda36c34ed9d43d775335f87e8719d383e2d4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 16 Jul 2024 14:33:30 +0800 Subject: vim-patch:8.2.5158: TSTP and INT signal tests are not run with valgrind Problem: TSTP and INT signal tests are not run with valgrind. Solution: Sleep a bit longer. (closes vim/vim#10614) https://github.com/vim/vim/commit/61e3784819d3776ec6fb40d97a12a1bb659e8143 Cherry-pick Test_signal_TSTP() from patch 8.2.3941. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_signals.vim | 55 ++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 7 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_signals.vim b/test/old/testdir/test_signals.vim index 2f9b6c09d8..b2dd7f9173 100644 --- a/test/old/testdir/test_signals.vim +++ b/test/old/testdir/test_signals.vim @@ -86,26 +86,67 @@ func Test_signal_INT() throw 'Skipped: INT signal not supported' endif - " Skip the test when running with valgrind as signal INT is not received - " somehow by Vim when running with valgrind. - let cmd = GetVimCommand() - if cmd =~ 'valgrind' - throw 'Skipped: cannot test signal INT with valgrind' - endif - let buf = RunVimInTerminal('', {'rows': 6}) let pid_vim = term_getjob(buf)->job_info().process " Check that an endless loop in Vim is interrupted by signal INT. + call term_sendkeys(buf, ":call setline(1, 'running')\n") call term_sendkeys(buf, ":while 1 | endwhile\n") call WaitForAssert({-> assert_equal(':while 1 | endwhile', term_getline(buf, 6))}) exe 'silent !kill -s INT ' .. pid_vim + sleep 50m call term_sendkeys(buf, ":call setline(1, 'INTERRUPTED')\n") call WaitForAssert({-> assert_equal('INTERRUPTED', term_getline(buf, 1))}) call StopVimInTerminal(buf) endfunc +" Test signal TSTP. Handler sets got_tstp. +func Test_signal_TSTP() + CheckRunVimInTerminal + if !HasSignal('TSTP') + throw 'Skipped: TSTP signal not supported' + endif + + " If test fails once, it can leave temporary files and trying to rerun + " the test would then fail again if they are not deleted first. + call delete('.Xsig_TERM.swp') + call delete('XsetupAucmd') + call delete('XautoOut') + let lines =<< trim END + au VimSuspend * call writefile(["VimSuspend triggered"], "XautoOut", "as") + au VimResume * call writefile(["VimResume triggered"], "XautoOut", "as") + END + call writefile(lines, 'XsetupAucmd') + + let buf = RunVimInTerminal('-S XsetupAucmd Xsig_TERM', {'rows': 6}) + let pid_vim = term_getjob(buf)->job_info().process + + call term_sendkeys(buf, ":call setline(1, 'foo')\n") + call WaitForAssert({-> assert_equal('foo', term_getline(buf, 1))}) + + call assert_false(filereadable('Xsig_TERM')) + + " After TSTP the file is not saved (same function as ^Z) + exe 'silent !kill -s TSTP ' .. pid_vim + call WaitForAssert({-> assert_true(filereadable('.Xsig_TERM.swp'))}) + + " We resume after the suspend. Sleep a bit for the signal to take effect, + " also when running under valgrind. + exe 'silent !kill -s CONT ' .. pid_vim + sleep 100m + + call StopVimInTerminal(buf) + + let result = readfile('XautoOut') + call assert_equal(["VimSuspend triggered", "VimResume triggered"], result) + + %bwipe! + call delete('.Xsig_TERM.swp') + call delete('XsetupAucmd') + call delete('XautoOut') +endfunc + " Test a deadly signal. " " There are several deadly signals: SISEGV, SIBUS, SIGTERM... -- cgit From e84a4c5a987f2bb428d46a73bed175ba36729be5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 16 Jul 2024 14:40:48 +0800 Subject: vim-patch:9.0.0393: signals test often fails on FreeBSD Problem: Signals test often fails on FreeBSD. Solution: Use separate files for Suspend and Resume. (Ken Takata, closes vim/vim#11065) https://github.com/vim/vim/commit/a9480dbc8c4381e4139db1ab7969722f4d100bac Co-authored-by: K.Takata --- test/old/testdir/test_signals.vim | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_signals.vim b/test/old/testdir/test_signals.vim index b2dd7f9173..3ec4b975e1 100644 --- a/test/old/testdir/test_signals.vim +++ b/test/old/testdir/test_signals.vim @@ -112,10 +112,11 @@ func Test_signal_TSTP() " the test would then fail again if they are not deleted first. call delete('.Xsig_TERM.swp') call delete('XsetupAucmd') - call delete('XautoOut') + call delete('XautoOut1') + call delete('XautoOut2') let lines =<< trim END - au VimSuspend * call writefile(["VimSuspend triggered"], "XautoOut", "as") - au VimResume * call writefile(["VimResume triggered"], "XautoOut", "as") + au VimSuspend * call writefile(["VimSuspend triggered"], "XautoOut1", "as") + au VimResume * call writefile(["VimResume triggered"], "XautoOut2", "as") END call writefile(lines, 'XsetupAucmd') @@ -130,21 +131,26 @@ func Test_signal_TSTP() " After TSTP the file is not saved (same function as ^Z) exe 'silent !kill -s TSTP ' .. pid_vim call WaitForAssert({-> assert_true(filereadable('.Xsig_TERM.swp'))}) + sleep 100m " We resume after the suspend. Sleep a bit for the signal to take effect, " also when running under valgrind. exe 'silent !kill -s CONT ' .. pid_vim - sleep 100m + call WaitForAssert({-> assert_true(filereadable('XautoOut2'))}) + sleep 10m call StopVimInTerminal(buf) - let result = readfile('XautoOut') - call assert_equal(["VimSuspend triggered", "VimResume triggered"], result) + let result = readfile('XautoOut1') + call assert_equal(["VimSuspend triggered"], result) + let result = readfile('XautoOut2') + call assert_equal(["VimResume triggered"], result) %bwipe! call delete('.Xsig_TERM.swp') call delete('XsetupAucmd') - call delete('XautoOut') + call delete('XautoOut1') + call delete('XautoOut2') endfunc " Test a deadly signal. -- cgit From 0bbccf7c5f4f13b57c027d734dc5086c15d0abda Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 16 Jul 2024 15:24:32 +0800 Subject: vim-patch:8.2.3381: crash when using NULL list with sign functions (#29740) Problem: Crash when using NULL list with sign functions. Solution: Handle a NULL list like an empty list. (issue vim/vim#8260) https://github.com/vim/vim/commit/5c56da4de8398566ef96122db44ec93e6c2d483a Nvim's TV_LIST_ITER_MOD() already checks for NULL. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_signs.vim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_signs.vim b/test/old/testdir/test_signs.vim index baeaeb0f3d..60a0448b76 100644 --- a/test/old/testdir/test_signs.vim +++ b/test/old/testdir/test_signs.vim @@ -2069,3 +2069,12 @@ func Test_sign_funcs_multi() enew! call delete("Xsign") endfunc + +func Test_sign_null_list() + eval v:_null_list->sign_define() + eval v:_null_list->sign_placelist() + eval v:_null_list->sign_undefine() + eval v:_null_list->sign_unplacelist() +endfunc + +" vim: shiftwidth=2 sts=2 expandtab -- cgit From 10fa9c8039ac324c0cd8a59959b89ddf45852410 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 16 Jul 2024 15:12:43 +0800 Subject: vim-patch:8.2.1651: spellfile code not completely tested Problem: Spellfile code not completely tested. Solution: Add a few more test cases. (Yegappan Lakshmanan, closes vim/vim#6918) https://github.com/vim/vim/commit/64e2db6dc6d7a013ff94ce302af8958cbd2704af Fix incorrect spellfile message. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_spellfile.vim | 67 +++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_spellfile.vim b/test/old/testdir/test_spellfile.vim index 509fed11df..96dc7d942b 100644 --- a/test/old/testdir/test_spellfile.vim +++ b/test/old/testdir/test_spellfile.vim @@ -191,6 +191,11 @@ func Spellfile_Test(content, emsg) " Add the spell file header and version (VIMspell2) let v = 0z56494D7370656C6C32 + a:content call writefile(v, splfile, 'b') + + " 'encoding' is set before each test to clear the previously loaded suggest + " file from memory. + set encoding=utf-8 + set runtimepath=./Xtest set spelllang=Xtest if a:emsg != '' @@ -311,6 +316,9 @@ func Test_spellfile_format_error() " SN_SOFO: missing sofoto call Spellfile_Test(0z0600000000050001610000, 'E759:') + " SN_SOFO: empty sofofrom and sofoto + call Spellfile_Test(0z06000000000400000000FF000000000000000000000000, '') + " SN_COMPOUND: compmax is less than 2 call Spellfile_Test(0z08000000000101, 'E759:') @@ -320,6 +328,12 @@ func Test_spellfile_format_error() " SN_COMPOUND: missing compoptions call Spellfile_Test(0z080000000005040101, 'E758:') + " SN_COMPOUND: missing comppattern + call Spellfile_Test(0z08000000000704010100000001, 'E758:') + + " SN_COMPOUND: incorrect comppatlen + call Spellfile_Test(0z080000000007040101000000020165, 'E758:') + " SN_INFO: missing info call Spellfile_Test(0z0F0000000005040101, '') @@ -329,6 +343,12 @@ func Test_spellfile_format_error() " SN_MAP: missing midword call Spellfile_Test(0z0700000000040102, '') + " SN_MAP: empty map string + call Spellfile_Test(0z070000000000FF000000000000000000000000, '') + + " SN_MAP: duplicate multibyte character + call Spellfile_Test(0z070000000004DC81DC81, 'E783:') + " SN_SYLLABLE: missing SYLLABLE item call Spellfile_Test(0z0900000000040102, '') @@ -345,12 +365,21 @@ func Test_spellfile_format_error() " LWORDTREE: missing tree node value call Spellfile_Test(0zFF0000000402, 'E758:') + " LWORDTREE: incorrect sibling node count + call Spellfile_Test(0zFF00000001040000000000000000, 'E759:') + " KWORDTREE: missing tree node call Spellfile_Test(0zFF0000000000000004, 'E758:') " PREFIXTREE: missing tree node call Spellfile_Test(0zFF000000000000000000000004, 'E758:') + " PREFIXTREE: incorrect prefcondnr + call Spellfile_Test(0zFF000000000000000000000002010200000020, 'E759:') + + " PREFIXTREE: invalid nodeidx + call Spellfile_Test(0zFF00000000000000000000000201010000, 'E759:') + let &rtp = save_rtp call delete('Xtest', 'rf') endfunc @@ -518,6 +547,14 @@ func Test_wordlist_dic() let output = execute('mkspell! -ascii Xwordlist.spl Xwordlist.dic') call assert_match('Ignored 1 words with non-ASCII characters', output) + " keep case of a word + let lines =<< trim [END] + example/= + [END] + call writefile(lines, 'Xwordlist.dic') + let output = execute('mkspell! Xwordlist.spl Xwordlist.dic') + call assert_match('Compressed keep-case:', output) + call delete('Xwordlist.spl') call delete('Xwordlist.dic') endfunc @@ -730,6 +767,36 @@ func Test_aff_file_format_error() let output = execute('mkspell! Xtest.spl Xtest') call assert_match('Illegal flag in Xtest.aff line 2: L', output) + " Nvim: non-utf8 encoding not supported + " " missing character in UPP entry. The character table is used only in a + " " non-utf8 encoding + " call writefile(['FOL abc', 'LOW abc', 'UPP A'], 'Xtest.aff') + " let save_encoding = &encoding + " set encoding=cp949 + " call assert_fails('mkspell! Xtest.spl Xtest', 'E761:') + " let &encoding = save_encoding + " + " " character range doesn't match between FOL and LOW entries + " call writefile(["FOL \u0102bc", 'LOW abc', 'UPP ABC'], 'Xtest.aff') + " let save_encoding = &encoding + " set encoding=cp949 + " call assert_fails('mkspell! Xtest.spl Xtest', 'E762:') + " let &encoding = save_encoding + " + " " character range doesn't match between FOL and UPP entries + " call writefile(["FOL \u0102bc", "LOW \u0102bc", 'UPP ABC'], 'Xtest.aff') + " let save_encoding = &encoding + " set encoding=cp949 + " call assert_fails('mkspell! Xtest.spl Xtest', 'E762:') + " let &encoding = save_encoding + " + " " additional characters in LOW and UPP entries + " call writefile(["FOL ab", "LOW abc", 'UPP ABC'], 'Xtest.aff') + " let save_encoding = &encoding + " set encoding=cp949 + " call assert_fails('mkspell! Xtest.spl Xtest', 'E761:') + " let &encoding = save_encoding + " duplicate word in the .dic file call writefile(['2', 'good', 'good', 'good'], 'Xtest.dic') call writefile(['NAME vim'], 'Xtest.aff') -- cgit From 7e5c5b4d853b05eee04bc01f2b5e0571d662f9c7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 16 Jul 2024 15:17:31 +0800 Subject: vim-patch:8.2.1659: spellfile code not completely tested Problem: Spellfile code not completely tested. Solution: Add a few more test cases. (Yegappan Lakshmanan, closes vim/vim#6929) https://github.com/vim/vim/commit/96fdf4348a50cdbe6b8f18ccb4806ba5b190989e Co-authored-by: Bram Moolenaar --- test/old/testdir/test_spell.vim | 1 + test/old/testdir/test_spellfile.vim | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_spell.vim b/test/old/testdir/test_spell.vim index d55a51e8eb..643744d817 100644 --- a/test/old/testdir/test_spell.vim +++ b/test/old/testdir/test_spell.vim @@ -125,6 +125,7 @@ foobar/? set spelllang= call assert_fails("call spellbadword('maxch')", 'E756:') + call assert_fails("spelldump", 'E756:') call delete('Xwords.spl') call delete('Xwords') diff --git a/test/old/testdir/test_spellfile.vim b/test/old/testdir/test_spellfile.vim index 96dc7d942b..50621144bd 100644 --- a/test/old/testdir/test_spellfile.vim +++ b/test/old/testdir/test_spellfile.vim @@ -319,6 +319,9 @@ func Test_spellfile_format_error() " SN_SOFO: empty sofofrom and sofoto call Spellfile_Test(0z06000000000400000000FF000000000000000000000000, '') + " SN_SOFO: multi-byte characters in sofofrom and sofoto + call Spellfile_Test(0z0600000000080002CF810002CF82FF000000000000000000000000, '') + " SN_COMPOUND: compmax is less than 2 call Spellfile_Test(0z08000000000101, 'E759:') @@ -562,8 +565,14 @@ endfunc " Test for the :mkspell command func Test_mkspell() call assert_fails('mkspell Xtest_us.spl', 'E751:') + call assert_fails('mkspell Xtest.spl abc', 'E484:') call assert_fails('mkspell a b c d e f g h i j k', 'E754:') + " create a .aff file but not the .dic file + call writefile([], 'Xtest.aff') + call assert_fails('mkspell Xtest.spl Xtest', 'E484:') + call delete('Xtest.aff') + call writefile([], 'Xtest.spl') call writefile([], 'Xtest.dic') call assert_fails('mkspell Xtest.spl Xtest.dic', 'E13:') @@ -796,6 +805,14 @@ func Test_aff_file_format_error() " set encoding=cp949 " call assert_fails('mkspell! Xtest.spl Xtest', 'E761:') " let &encoding = save_encoding + " + " " missing UPP entry + " call writefile(["FOL abc", "LOW abc"], 'Xtest.aff') + " let save_encoding = &encoding + " set encoding=cp949 + " let output = execute('mkspell! Xtest.spl Xtest') + " call assert_match('Missing FOL/LOW/UPP line in Xtest.aff', output) + " let &encoding = save_encoding " duplicate word in the .dic file call writefile(['2', 'good', 'good', 'good'], 'Xtest.dic') @@ -804,6 +821,20 @@ func Test_aff_file_format_error() call assert_match('First duplicate word in Xtest.dic line 3: good', output) call assert_match('2 duplicate word(s) in Xtest.dic', output) + " use multiple .aff files with different values for COMPOUNDWORDMAX and + " MIDWORD (number and string) + call writefile(['1', 'world'], 'Xtest_US.dic') + call writefile(['1', 'world'], 'Xtest_CA.dic') + call writefile(["COMPOUNDWORDMAX 3", "MIDWORD '-"], 'Xtest_US.aff') + call writefile(["COMPOUNDWORDMAX 4", "MIDWORD '="], 'Xtest_CA.aff') + let output = execute('mkspell! Xtest.spl Xtest_US Xtest_CA') + call assert_match('COMPOUNDWORDMAX value differs from what is used in another .aff file', output) + call assert_match('MIDWORD value differs from what is used in another .aff file', output) + call delete('Xtest_US.dic') + call delete('Xtest_CA.dic') + call delete('Xtest_US.aff') + call delete('Xtest_CA.aff') + call delete('Xtest.dic') call delete('Xtest.aff') call delete('Xtest.spl') -- cgit From 4025c2aa5f788ba2772d8f0dd3f7add499333878 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 17 Jul 2024 09:20:41 +0800 Subject: vim-patch:8.2.0281: two placed signs in the same line are not combined (#29757) Problem: Two placed signs in the same line are not combined. E.g. in the terminal debugger a breakpoint and the PC cannot be both be displayed. Solution: Combine the sign column and line highlight attributes. https://github.com/vim/vim/commit/a2f6e42ded067df8ee682c15aa246491a389b1a0 Nvim already does this in decor_redraw_signs(). Co-authored-by: Bram Moolenaar --- test/old/testdir/test_signs.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_signs.vim b/test/old/testdir/test_signs.vim index 60a0448b76..1bb2ddd978 100644 --- a/test/old/testdir/test_signs.vim +++ b/test/old/testdir/test_signs.vim @@ -1816,6 +1816,7 @@ func Test_sign_cursor_position() call setline(1, [repeat('x', 75), 'mmmm', 'yyyy']) call cursor(2,1) sign define s1 texthl=Search text==> + sign define s2 linehl=Pmenu redraw sign place 10 line=2 name=s1 END @@ -1827,11 +1828,15 @@ func Test_sign_cursor_position() call term_sendkeys(buf, ":sign define s1 text=-)\") call VerifyScreenDump(buf, 'Test_sign_cursor_2', {}) + " Also place a line HL sign + call term_sendkeys(buf, ":sign place 11 line=2 name=s2\") + call VerifyScreenDump(buf, 'Test_sign_cursor_3', {}) + " update cursor position calculation call term_sendkeys(buf, "lh") + call term_sendkeys(buf, ":sign unplace 11\") call term_sendkeys(buf, ":sign unplace 10\") - call VerifyScreenDump(buf, 'Test_sign_cursor_3', {}) - + call VerifyScreenDump(buf, 'Test_sign_cursor_4', {}) " clean up call StopVimInTerminal(buf) -- cgit From 8f890f74b692406485f1bbdf22ec608421f58886 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 17 Jul 2024 10:50:19 +0800 Subject: test(old): reorder test_regexp_latin.vim to match upstream --- test/old/testdir/test_regexp_latin.vim | 102 +++++++++++++++++++++------------ test/old/testdir/test_regexp_utf8.vim | 32 ----------- 2 files changed, 66 insertions(+), 68 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_regexp_latin.vim b/test/old/testdir/test_regexp_latin.vim index 2cfa81e078..c8eb7ef000 100644 --- a/test/old/testdir/test_regexp_latin.vim +++ b/test/old/testdir/test_regexp_latin.vim @@ -28,61 +28,47 @@ func s:equivalence_test() endfunc func Test_equivalence_re1() - throw 'skipped: Nvim does not support enc=latin1' set re=1 call s:equivalence_test() endfunc func Test_equivalence_re2() - throw 'skipped: Nvim does not support enc=latin1' set re=2 call s:equivalence_test() endfunc -func Test_range_with_newline() +func Test_recursive_substitute() new - call setline(1, "a") - call assert_equal(0, search("[ -*\\n- ]")) - call assert_equal(0, search("[ -*\\t-\\n]")) + s/^/\=execute("s#^##gn") + " check we are now not in the sandbox + call setwinvar(1, 'myvar', 1) bwipe! endfunc -func Test_pattern_compile_speed() - CheckOption spellcapcheck - CheckFunction reltimefloat - - let start = reltime() - " this used to be very slow, not it should be about a second - set spc=\\v(((((Nxxxxxxx&&xxxx){179})+)+)+){179} - call assert_inrange(0.01, 10.0, reltimefloat(reltime(start))) - set spc= -endfunc - -func Test_get_equi_class() +func Test_nested_backrefs() + " Check example in change.txt. new - " Incomplete equivalence class caused invalid memory access - s/^/[[= - call assert_equal(1, search(getline(1))) - s/.*/[[. - call assert_equal(1, search(getline(1))) -endfunc + for re in range(0, 2) + exe 'set re=' . re + call setline(1, 'aa ab x') + 1s/\(\(a[a-d] \)*\)\(x\)/-\1- -\2- -\3-/ + call assert_equal('-aa ab - -ab - -x-', getline(1)) -func Test_rex_init() - set noincsearch - set re=1 - new - setlocal iskeyword=a-z - call setline(1, ['abc', 'ABC']) - call assert_equal(1, search('[[:keyword:]]')) - new - setlocal iskeyword=A-Z - call setline(1, ['abc', 'ABC']) - call assert_equal(2, search('[[:keyword:]]')) - bwipe! + call assert_equal('-aa ab - -ab - -x-', substitute('aa ab x', '\(\(a[a-d] \)*\)\(x\)', '-\1- -\2- -\3-', '')) + endfor bwipe! set re=0 endfunc +func Test_eow_with_optional() + let expected = ['abc def', 'abc', 'def', '', '', '', '', '', '', ''] + for re in range(0, 2) + exe 'set re=' . re + let actual = matchlist('abc def', '\(abc\>\)\?\s*\(def\)') + call assert_equal(expected, actual) + endfor +endfunc + func Test_backref() new call setline(1, ['one', 'two', 'three', 'four', 'five']) @@ -144,6 +130,50 @@ func Test_out_of_memory() call assert_fails('call search("\\v((n||<)+);")', 'E363:') endfunc +func Test_get_equi_class() + new + " Incomplete equivalence class caused invalid memory access + s/^/[[= + call assert_equal(1, search(getline(1))) + s/.*/[[. + call assert_equal(1, search(getline(1))) +endfunc + +func Test_rex_init() + set noincsearch + set re=1 + new + setlocal iskeyword=a-z + call setline(1, ['abc', 'ABC']) + call assert_equal(1, search('[[:keyword:]]')) + new + setlocal iskeyword=A-Z + call setline(1, ['abc', 'ABC']) + call assert_equal(2, search('[[:keyword:]]')) + bwipe! + bwipe! + set re=0 +endfunc + +func Test_range_with_newline() + new + call setline(1, "a") + call assert_equal(0, search("[ -*\\n- ]")) + call assert_equal(0, search("[ -*\\t-\\n]")) + bwipe! +endfunc + +func Test_pattern_compile_speed() + CheckOption spellcapcheck + CheckFunction reltimefloat + + let start = reltime() + " this used to be very slow, not it should be about a second + set spc=\\v(((((Nxxxxxxx&&xxxx){179})+)+)+){179} + call assert_inrange(0.01, 10.0, reltimefloat(reltime(start))) + set spc= +endfunc + " Tests for regexp patterns without multi-byte support. func Test_regexp_single_line_pat() " tl is a List of Lists with: diff --git a/test/old/testdir/test_regexp_utf8.vim b/test/old/testdir/test_regexp_utf8.vim index 728a88fa0f..f9ad1fc7ca 100644 --- a/test/old/testdir/test_regexp_utf8.vim +++ b/test/old/testdir/test_regexp_utf8.vim @@ -188,38 +188,6 @@ func Test_classes_re2() set re=0 endfunc -func Test_recursive_substitute() - new - s/^/\=execute("s#^##gn") - " check we are now not in the sandbox - call setwinvar(1, 'myvar', 1) - bwipe! -endfunc - -func Test_nested_backrefs() - " Check example in change.txt. - new - for re in range(0, 2) - exe 'set re=' . re - call setline(1, 'aa ab x') - 1s/\(\(a[a-d] \)*\)\(x\)/-\1- -\2- -\3-/ - call assert_equal('-aa ab - -ab - -x-', getline(1)) - - call assert_equal('-aa ab - -ab - -x-', substitute('aa ab x', '\(\(a[a-d] \)*\)\(x\)', '-\1- -\2- -\3-', '')) - endfor - bwipe! - set re=0 -endfunc - -func Test_eow_with_optional() - let expected = ['abc def', 'abc', 'def', '', '', '', '', '', '', ''] - for re in range(0, 2) - exe 'set re=' . re - let actual = matchlist('abc def', '\(abc\>\)\?\s*\(def\)') - call assert_equal(expected, actual) - endfor -endfunc - func Test_reversed_range() for re in range(0, 2) exe 'set re=' . re -- cgit From dce615bc425795ad65f96ed1879ba37ff6a030d8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 17 Jul 2024 10:31:23 +0800 Subject: vim-patch:9.0.0228: crash when pattern looks below the last line Problem: Crash when pattern looks below the last line. Solution: Consider invalid lines to be empty. (closes vim/vim#10938) https://github.com/vim/vim/commit/13ed494bb5edc5a02d0ed0feabddb68920f88570 Comment out the test as it uses Vim9 script and text properties. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_regexp_latin.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_regexp_latin.vim b/test/old/testdir/test_regexp_latin.vim index c8eb7ef000..de73ae633f 100644 --- a/test/old/testdir/test_regexp_latin.vim +++ b/test/old/testdir/test_regexp_latin.vim @@ -1135,4 +1135,16 @@ func Test_recursive_substitute_expr() delfunc Repl endfunc +" def Test_compare_columns() +" # this was using a line below the last line +" enew +" setline(1, ['', '']) +" prop_type_add('name', {highlight: 'ErrorMsg'}) +" prop_add(1, 1, {length: 1, type: 'name'}) +" search('\%#=1\%>.l\n.*\%<2v', 'nW') +" search('\%#=2\%>.l\n.*\%<2v', 'nW') +" bwipe! +" prop_type_delete('name') +" enddef + " vim: shiftwidth=2 sts=2 expandtab -- cgit From ccdbab7810bd40a44a0a502d478b0d06073388e9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 17 Jul 2024 10:38:40 +0800 Subject: vim-patch:9.0.0407: matchstr() does match column offset Problem: matchstr() does match column offset. (Yasuhiro Matsumoto) Solution: Accept line number zero. (closes vim/vim#10938) https://github.com/vim/vim/commit/75a115e8d632e96b4f45dc5145ba261876a83dcf Co-authored-by: Bram Moolenaar --- test/old/testdir/test_regexp_latin.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_regexp_latin.vim b/test/old/testdir/test_regexp_latin.vim index de73ae633f..754fa8c868 100644 --- a/test/old/testdir/test_regexp_latin.vim +++ b/test/old/testdir/test_regexp_latin.vim @@ -30,11 +30,13 @@ endfunc func Test_equivalence_re1() set re=1 call s:equivalence_test() + set re=0 endfunc func Test_equivalence_re2() set re=2 call s:equivalence_test() + set re=0 endfunc func Test_recursive_substitute() @@ -67,6 +69,7 @@ func Test_eow_with_optional() let actual = matchlist('abc def', '\(abc\>\)\?\s*\(def\)') call assert_equal(expected, actual) endfor + set re=0 endfunc func Test_backref() @@ -1147,4 +1150,14 @@ endfunc " prop_type_delete('name') " enddef +func Test_compare_column_matchstr() + enew + set re=1 + call assert_equal('aaa', matchstr('aaaaaaaaaaaaaaaaaaaa', '.*\%<5v')) + set re=2 + call assert_equal('aaa', matchstr('aaaaaaaaaaaaaaaaaaaa', '.*\%<5v')) + set re=0 +endfunc + + " vim: shiftwidth=2 sts=2 expandtab -- cgit From e83949f96c59de706a175a017e6a080b838118d1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 17 Jul 2024 10:55:18 +0800 Subject: vim-patch:9.0.0414: matchstr() still does not match column offset Problem: matchstr() still does not match column offset when done after a text search. Solution: Only use the line number for a multi-line search. Fix the test. (closes vim/vim#10938) https://github.com/vim/vim/commit/753aead960f163d0d3f8ce523ea523f2e0cec06d Co-authored-by: Bram Moolenaar --- test/old/testdir/test_regexp_latin.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_regexp_latin.vim b/test/old/testdir/test_regexp_latin.vim index 754fa8c868..ac46d0b17b 100644 --- a/test/old/testdir/test_regexp_latin.vim +++ b/test/old/testdir/test_regexp_latin.vim @@ -1151,7 +1151,13 @@ endfunc " enddef func Test_compare_column_matchstr() + " do some search in text to set the line number, it should be ignored in + " matchstr(). enew + call setline(1, ['one', 'two', 'three']) + :3 + :/ee + bwipe! set re=1 call assert_equal('aaa', matchstr('aaaaaaaaaaaaaaaaaaaa', '.*\%<5v')) set re=2 -- cgit From 79002cf438093aedb3ebea72e4e597217bfd4766 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 17 Jul 2024 11:33:45 +0800 Subject: vim-patch:8.2.2656: some command line arguments and regexp errors not tested (#29761) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Some command line arguments and regexp errors not tested. Solution: Add a few test cases. (Dominique Pellé, closes vim/vim#8013) https://github.com/vim/vim/commit/a2b3e7dc9201fb3d8782c6b4ab53862160e254da Co-authored-by: Bram Moolenaar --- test/old/testdir/test_regexp_latin.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_regexp_latin.vim b/test/old/testdir/test_regexp_latin.vim index ac46d0b17b..9857e1f886 100644 --- a/test/old/testdir/test_regexp_latin.vim +++ b/test/old/testdir/test_regexp_latin.vim @@ -970,8 +970,17 @@ func Test_regexp_error() call assert_fails("call matchlist('x x', '\\%#=1 \\ze*')", 'E888:') call assert_fails("call matchlist('x x', '\\%#=2 \\zs*')", 'E888:') call assert_fails("call matchlist('x x', '\\%#=2 \\ze*')", 'E888:') - call assert_fails('exe "normal /\\%#=1\\%[x\\%[x]]\"', 'E369:') call assert_fails("call matchstr('abcd', '\\%o841\\%o142')", 'E678:') + call assert_fails("call matchstr('abcd', '\\%#=2\\%2147483647c')", 'E951:') + call assert_fails("call matchstr('abcd', '\\%#=2\\%2147483647l')", 'E951:') + call assert_fails("call matchstr('abcd', '\\%#=2\\%2147483647v')", 'E951:') + call assert_fails('exe "normal /\\%#=1\\%[x\\%[x]]\"', 'E369:') + call assert_fails('exe "normal /\\%#=2\\%2147483647l\"', 'E951:') + call assert_fails('exe "normal /\\%#=2\\%2147483647c\"', 'E951:') + call assert_fails('exe "normal /\\%#=2\\%102261126v\"', 'E951:') + call assert_fails('exe "normal /\\%#=2\\%2147483646l\"', 'E486:') + call assert_fails('exe "normal /\\%#=2\\%2147483646c\"', 'E486:') + call assert_fails('exe "normal /\\%#=2\\%102261125v\"', 'E486:') call assert_equal('', matchstr('abcd', '\%o181\%o142')) endfunc -- cgit From 4a7371c71486653253ae440a9a4017768ad36262 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 16 Jul 2024 22:22:18 +0200 Subject: vim-patch:9.1.0591: filetype: *.wl files are not recognized Problem: filetype: *.wl files are not recognized Solution: Detect '*.wl' files as Mathematica package files (Jonas Dujava) closes: vim/vim#15269 https://github.com/vim/vim/commit/c6d7dc039342fbe1cf432c7f8e7e391063de210b Co-authored-by: Jonas Dujava --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index d6518c46c7..82e9c877ca 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -471,7 +471,7 @@ func s:GetFilenameChecks() abort \ 'mgp': ['file.mgp'], \ 'mib': ['file.mib', 'file.my'], \ 'mix': ['file.mix', 'file.mixal'], - \ 'mma': ['file.nb'], + \ 'mma': ['file.nb', 'file.wl'], \ 'mmp': ['file.mmp'], \ 'modconf': ['/etc/modules.conf', '/etc/modules', '/etc/conf.modules', '/etc/modprobe.file', 'any/etc/conf.modules', 'any/etc/modprobe.file', 'any/etc/modules', 'any/etc/modules.conf'], \ 'modula3': ['file.m3', 'file.mg', 'file.i3', 'file.ig', 'file.lm3'], -- cgit From 61ea4665916909853cf74256a6b350a680f08565 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 16 Jul 2024 22:23:44 +0200 Subject: vim-patch:9.1.0592: runtime: filetype: Mediawiki files are not recognized Problem: filetype: Mediawiki files are not recognized Solution: detect "*.mw" and "*.wiki" as mediawiki filetype, include basic syntax and filetype plugins. (AvidSeeker) closes: vim/vim#15266 https://github.com/vim/vim/commit/b5844104ab1259e061e023ea6259e4eb002e7170 Co-authored-by: AvidSeeker --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 82e9c877ca..6db4cfd696 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -437,6 +437,7 @@ func s:GetFilenameChecks() abort \ 'matlab': ['file.m'], \ 'maxima': ['file.demo', 'file.dmt', 'file.dm1', 'file.dm2', 'file.dm3', \ 'file.wxm', 'maxima-init.mac'], + \ 'mediawiki': ['file.mw', 'file.wiki'], \ 'mel': ['file.mel'], \ 'mermaid': ['file.mmd', 'file.mmdc', 'file.mermaid'], \ 'meson': ['meson.build', 'meson.options', 'meson_options.txt'], -- cgit From 8e590cae83c321445a598fcd87bb31b6187402f7 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 16 Jul 2024 22:29:39 +0200 Subject: vim-patch:9.1.0593: filetype: Asymptote files are not recognized Problem: filetype: Asymptote files are not recognized Solution: detect '*.asy' files as asy filetype, include ftplugin and syntax plugin (AvidSeeker). Reference: https://asymptote.sourceforge.io/ closes: vim/vim#15252 https://github.com/vim/vim/commit/3088ef094da721dac8c0363a6c9e14eaf9313929 Co-authored-by: AvidSeeker --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 6db4cfd696..adc5ee076b 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -108,6 +108,7 @@ func s:GetFilenameChecks() abort \ 'asn': ['file.asn', 'file.asn1'], \ 'asterisk': ['asterisk/file.conf', 'asterisk/file.conf-file', 'some-asterisk/file.conf', 'some-asterisk/file.conf-file'], \ 'astro': ['file.astro'], + \ 'asy': ['file.asy'], \ 'atlas': ['file.atl', 'file.as'], \ 'authzed': ['schema.zed'], \ 'autohotkey': ['file.ahk'], -- cgit From 5d7fd74397a9fb96bc9d1f72c402884b51255bf2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 17 Jul 2024 20:06:59 +0800 Subject: vim-patch:8.1.1588: in :let-heredoc line continuation is recognized (#29767) Problem: In :let-heredoc line continuation is recognized. Solution: Do not consume line continuation. (Ozaki Kiichi, closes vim/vim#4580) https://github.com/vim/vim/commit/e96a2498f9a2d3e93ac07431f6d4afd77f30afdf Nvim already sets may_garbage_collect to false in nv_event(), so the timer change isn't needed. Other changes have already been ported. Also fix incorrect port of test in patch 8.1.1356. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_let.vim | 20 ++++++++++++++------ test/old/testdir/test_startup.vim | 1 + 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_let.vim b/test/old/testdir/test_let.vim index d37af45aaa..44852c1d38 100644 --- a/test/old/testdir/test_let.vim +++ b/test/old/testdir/test_let.vim @@ -521,12 +521,12 @@ END END call assert_equal(['vim', '', 'end', ' END', 'END '], var3) - let var1 =<< trim END - Line1 - Line2 - Line3 - END - END + let var1 =<< trim END + Line1 + Line2 + Line3 + END + END call assert_equal(['Line1', ' Line2', "\tLine3", ' END'], var1) let var1 =<< trim !!! @@ -563,6 +563,14 @@ END END call assert_equal(['something', 'endfunc'], var1) + " not concatenate lines + let var1 =<< END +some + \thing + \ else +END + call assert_equal(['some', ' \thing', ' \ else'], var1) + " ignore "python << xx" let var1 =< Date: Wed, 17 Jul 2024 09:24:52 +0800 Subject: vim-patch:partial:9.0.0719: too many delete() calls in tests Problem: Too many delete() calls in tests. Solution: Use deferred delete where possible. https://github.com/vim/vim/commit/56564964e6d0956c29687e8a10cb94fe42f5c097 This includes all changes expect changes in test_startup.vim. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_scriptnames.vim | 7 +-- test/old/testdir/test_search.vim | 58 ++++++++--------------- test/old/testdir/test_search_stat.vim | 12 ++--- test/old/testdir/test_shell.vim | 3 +- test/old/testdir/test_signals.vim | 6 +-- test/old/testdir/test_signs.vim | 27 ++++------- test/old/testdir/test_sort.vim | 3 +- test/old/testdir/test_source.vim | 6 +-- test/old/testdir/test_source_utf8.vim | 3 +- test/old/testdir/test_spell.vim | 9 ++-- test/old/testdir/test_spell_utf8.vim | 6 +-- test/old/testdir/test_spellfile.vim | 87 ++++++++++++---------------------- test/old/testdir/test_startup_utf8.vim | 19 ++++---- test/old/testdir/test_stat.vim | 12 ++--- test/old/testdir/test_statusline.vim | 9 ++-- test/old/testdir/test_substitute.vim | 6 +-- test/old/testdir/test_swap.vim | 55 ++++++++------------- test/old/testdir/test_syntax.vim | 26 +++++----- test/old/testdir/test_system.vim | 3 +- 19 files changed, 126 insertions(+), 231 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_scriptnames.vim b/test/old/testdir/test_scriptnames.vim index 69e5e526fd..13b09a601a 100644 --- a/test/old/testdir/test_scriptnames.vim +++ b/test/old/testdir/test_scriptnames.vim @@ -1,7 +1,7 @@ " Test for the :scriptnames command func Test_scriptnames() - call writefile(['let did_load_script = 123'], 'Xscripting') + call writefile(['let did_load_script = 123'], 'Xscripting', 'D') source Xscripting call assert_equal(123, g:did_load_script) @@ -22,7 +22,6 @@ func Test_scriptnames() call assert_equal('Xscripting', expand('%:t')) bwipe - call delete('Xscripting') let msgs = execute('messages') scriptnames @@ -47,7 +46,7 @@ func Test_getscriptinfo() " def Xscript_def_func2() " enddef END - call writefile(lines, 'X22script91') + call writefile(lines, 'X22script91', 'D') source X22script91 let l = getscriptinfo() call assert_match('X22script91$', l[-1].name) @@ -103,8 +102,6 @@ func Test_getscriptinfo() let max_sid = max(map(getscriptinfo(), { k, v -> v.sid })) call assert_equal([], getscriptinfo({'sid': max_sid + 1})) - - call delete('X22script91') endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_search.vim b/test/old/testdir/test_search.vim index 8b535b5b19..077a7d03a3 100644 --- a/test/old/testdir/test_search.vim +++ b/test/old/testdir/test_search.vim @@ -674,7 +674,7 @@ func Test_search_cmdline8() endif " Prepare buffer text let lines = ['abb vim vim vi', 'vimvivim'] - call writefile(lines, 'Xsearch.txt') + call writefile(lines, 'Xsearch.txt', 'D') let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3}) call WaitForAssert({-> assert_equal(lines, [term_getline(buf, 1), term_getline(buf, 2)])}) @@ -693,9 +693,8 @@ func Test_search_cmdline8() call assert_notequal(a1, a2) call assert_equal(a0, a2) call assert_equal(a1, a3) - " clean up - call delete('Xsearch.txt') + " clean up bwipe! endfunc @@ -810,7 +809,7 @@ func Test_search_cmdline_incsearch_highlight_attr() " Prepare buffer text let lines = ['abb vim vim vi', 'vimvivim'] - call writefile(lines, 'Xsearch.txt') + call writefile(lines, 'Xsearch.txt', 'D') let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile', 'Xsearch.txt'], {'term_rows': 3}) call WaitForAssert({-> assert_equal(lines, [term_getline(buf, 1), term_getline(buf, 2)])}) @@ -879,9 +878,7 @@ func Test_search_cmdline_incsearch_highlight_attr() let attr_line2 = [a0,a0,a0,a0,a0,a0,a0,a0] call assert_equal(attr_line1, map(term_scrape(buf, 1)[:len(attr_line1)-1], 'v:val.attr')) call assert_equal(attr_line2, map(term_scrape(buf, 2)[:len(attr_line2)-1], 'v:val.attr')) - call delete('Xsearch.txt') - call delete('Xsearch.txt') bwipe! endfunc @@ -908,7 +905,7 @@ func Test_incsearch_scrolling() \ 'call setline(1, [dots, dots, dots, "", "target", dots, dots])', \ 'normal gg', \ 'redraw', - \ ], 'Xscript') + \ ], 'Xscript', 'D') let buf = RunVimInTerminal('-S Xscript', {'rows': 9, 'cols': 70}) " Need to send one key at a time to force a redraw call term_sendkeys(buf, '/') @@ -924,7 +921,6 @@ func Test_incsearch_scrolling() call term_sendkeys(buf, "\") call StopVimInTerminal(buf) - call delete('Xscript') endfunc func Test_incsearch_search_dump() @@ -937,7 +933,7 @@ func Test_incsearch_search_dump() \ ' call setline(n, "foo " . n)', \ 'endfor', \ '3', - \ ], 'Xis_search_script') + \ ], 'Xis_search_script', 'D') let buf = RunVimInTerminal('-S Xis_search_script', {'rows': 9, 'cols': 70}) " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by " the 'ambiwidth' check. @@ -954,7 +950,6 @@ func Test_incsearch_search_dump() call term_sendkeys(buf, "\") call StopVimInTerminal(buf) - call delete('Xis_search_script') endfunc func Test_hlsearch_dump() @@ -966,7 +961,7 @@ func Test_hlsearch_dump() \ 'call setline(1, ["xxx", "xxx", "xxx"])', \ '/.*', \ '2', - \ ], 'Xhlsearch_script') + \ ], 'Xhlsearch_script', 'D') let buf = RunVimInTerminal('-S Xhlsearch_script', {'rows': 6, 'cols': 50}) call VerifyScreenDump(buf, 'Test_hlsearch_1', {}) @@ -974,7 +969,6 @@ func Test_hlsearch_dump() call VerifyScreenDump(buf, 'Test_hlsearch_2', {}) call StopVimInTerminal(buf) - call delete('Xhlsearch_script') endfunc func Test_hlsearch_and_visual() @@ -987,14 +981,13 @@ func Test_hlsearch_and_visual() \ 'hi Search cterm=bold', \ '/yyy', \ 'call cursor(1, 6)', - \ ], 'Xhlvisual_script') + \ ], 'Xhlvisual_script', 'D') let buf = RunVimInTerminal('-S Xhlvisual_script', {'rows': 6, 'cols': 40}) call term_sendkeys(buf, "vjj") call VerifyScreenDump(buf, 'Test_hlsearch_visual_1', {}) call term_sendkeys(buf, "\") call StopVimInTerminal(buf) - call delete('Xhlvisual_script') endfunc func Test_hlsearch_block_visual_match() @@ -1004,7 +997,7 @@ func Test_hlsearch_block_visual_match() set hlsearch call setline(1, ['aa', 'bbbb', 'cccccc']) END - call writefile(lines, 'Xhlsearch_block') + call writefile(lines, 'Xhlsearch_block', 'D') let buf = RunVimInTerminal('-S Xhlsearch_block', {'rows': 9, 'cols': 60}) call term_sendkeys(buf, "G\$kk\") @@ -1014,7 +1007,6 @@ func Test_hlsearch_block_visual_match() call VerifyScreenDump(buf, 'Test_hlsearch_block_visual_match', {}) call StopVimInTerminal(buf) - call delete('Xhlsearch_block') endfunc func Test_incsearch_substitute() @@ -1062,7 +1054,7 @@ func Test_hlsearch_cursearch() hi Search ctermbg=yellow hi CurSearch ctermbg=blue END - call writefile(lines, 'Xhlsearch_cursearch') + call writefile(lines, 'Xhlsearch_cursearch', 'D') let buf = RunVimInTerminal('-S Xhlsearch_cursearch', {'rows': 9, 'cols': 60}) call term_sendkeys(buf, "gg/foo\") @@ -1100,7 +1092,6 @@ func Test_hlsearch_cursearch() call VerifyScreenDump(buf, 'Test_hlsearch_cursearch_changed_1', {}) call StopVimInTerminal(buf) - call delete('Xhlsearch_cursearch') endfunc " Similar to Test_incsearch_substitute() but with a screendump halfway. @@ -1115,7 +1106,7 @@ func Test_incsearch_substitute_dump() \ 'endfor', \ 'call setline(11, "bar 11")', \ '3', - \ ], 'Xis_subst_script') + \ ], 'Xis_subst_script', 'D') let buf = RunVimInTerminal('-S Xis_subst_script', {'rows': 9, 'cols': 70}) " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by " the 'ambiwidth' check. @@ -1210,7 +1201,6 @@ func Test_incsearch_substitute_dump() call term_sendkeys(buf, "") call StopVimInTerminal(buf) - call delete('Xis_subst_script') endfunc func Test_incsearch_highlighting() @@ -1220,7 +1210,7 @@ func Test_incsearch_highlighting() call writefile([ \ 'set incsearch hlsearch', \ 'call setline(1, "hello/there")', - \ ], 'Xis_subst_hl_script') + \ ], 'Xis_subst_hl_script', 'D') let buf = RunVimInTerminal('-S Xis_subst_hl_script', {'rows': 4, 'cols': 20}) " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by " the 'ambiwidth' check. @@ -1233,7 +1223,6 @@ func Test_incsearch_highlighting() call term_sendkeys(buf, "") call StopVimInTerminal(buf) - call delete('Xis_subst_hl_script') endfunc func Test_incsearch_with_change() @@ -1245,7 +1234,7 @@ func Test_incsearch_with_change() \ 'set incsearch hlsearch scrolloff=0', \ 'call setline(1, ["one", "two ------ X", "three"])', \ 'call timer_start(200, { _ -> setline(2, "x")})', - \ ], 'Xis_change_script') + \ ], 'Xis_change_script', 'D') let buf = RunVimInTerminal('-S Xis_change_script', {'rows': 9, 'cols': 70}) " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by " the 'ambiwidth' check. @@ -1257,7 +1246,6 @@ func Test_incsearch_with_change() call term_sendkeys(buf, "\") call StopVimInTerminal(buf) - call delete('Xis_change_script') endfunc " Similar to Test_incsearch_substitute_dump() for :sort @@ -1268,7 +1256,7 @@ func Test_incsearch_sort_dump() call writefile([ \ 'set incsearch hlsearch scrolloff=0', \ 'call setline(1, ["another one 2", "that one 3", "the one 1"])', - \ ], 'Xis_sort_script') + \ ], 'Xis_sort_script', 'D') let buf = RunVimInTerminal('-S Xis_sort_script', {'rows': 9, 'cols': 70}) " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by " the 'ambiwidth' check. @@ -1283,7 +1271,6 @@ func Test_incsearch_sort_dump() call term_sendkeys(buf, "\") call StopVimInTerminal(buf) - call delete('Xis_sort_script') endfunc " Similar to Test_incsearch_substitute_dump() for :vimgrep famiry @@ -1294,7 +1281,7 @@ func Test_incsearch_vimgrep_dump() call writefile([ \ 'set incsearch hlsearch scrolloff=0', \ 'call setline(1, ["another one 2", "that one 3", "the one 1"])', - \ ], 'Xis_vimgrep_script') + \ ], 'Xis_vimgrep_script', 'D') let buf = RunVimInTerminal('-S Xis_vimgrep_script', {'rows': 9, 'cols': 70}) " Give Vim a chance to redraw to get rid of the spaces in line 2 caused by " the 'ambiwidth' check. @@ -1322,7 +1309,6 @@ func Test_incsearch_vimgrep_dump() call term_sendkeys(buf, "\") call StopVimInTerminal(buf) - call delete('Xis_vimgrep_script') endfunc func Test_keep_last_search_pattern() @@ -1465,11 +1451,9 @@ endfunc func Test_no_last_substitute_pat() " Use viminfo to set the last search pattern to a string and make the last " substitute pattern the most recent used and make it empty (NULL). - call writefile(['~MSle0/bar', '~MSle0~&'], 'Xviminfo') + call writefile(['~MSle0/bar', '~MSle0~&'], 'Xviminfo', 'D') rviminfo! Xviminfo call assert_fails('normal n', 'E35:') - - call delete('Xviminfo') endfunc func Test_search_Ctrl_L_combining() @@ -1676,12 +1660,11 @@ func Test_search_with_no_last_pat() call writefile(v:errors, 'Xresult') qall! [SCRIPT] - call writefile(lines, 'Xscript') + call writefile(lines, 'Xscript', 'D') if RunVim([], [], '--clean -S Xscript') call assert_equal([], readfile('Xresult')) endif - call delete('Xscript') call delete('Xresult') endfunc @@ -1699,11 +1682,10 @@ func Test_search_tilde_pat() call writefile(v:errors, 'Xresult') qall! [SCRIPT] - call writefile(lines, 'Xscript') + call writefile(lines, 'Xscript', 'D') if RunVim([], [], '--clean -S Xscript') call assert_equal([], readfile('Xresult')) endif - call delete('Xscript') call delete('Xresult') endfunc @@ -1971,7 +1953,7 @@ func Test_incsearch_highlighting_newline() set incsearch nohls call setline(1, ['test', 'xxx']) [CODE] - call writefile(commands, 'Xincsearch_nl') + call writefile(commands, 'Xincsearch_nl', 'D') let buf = RunVimInTerminal('-S Xincsearch_nl', {'rows': 5, 'cols': 10}) call term_sendkeys(buf, '/test') call VerifyScreenDump(buf, 'Test_incsearch_newline1', {}) @@ -1987,7 +1969,6 @@ func Test_incsearch_highlighting_newline() call StopVimInTerminal(buf) " clean up - call delete('Xincsearch_nl') call test_override("char_avail", 0) bw endfunc @@ -2128,11 +2109,10 @@ func Test_search_with_invalid_range() 5/ c END - call writefile(lines, 'Xrangesearch') + call writefile(lines, 'Xrangesearch', 'D') source Xrangesearch bwipe! - call delete('Xrangesearch') endfunc diff --git a/test/old/testdir/test_search_stat.vim b/test/old/testdir/test_search_stat.vim index a2523fc6c7..b57b7ba7b0 100644 --- a/test/old/testdir/test_search_stat.vim +++ b/test/old/testdir/test_search_stat.vim @@ -308,7 +308,7 @@ func Test_searchcount_in_statusline() set hlsearch set laststatus=2 statusline+=%{TestSearchCount()} END - call writefile(lines, 'Xsearchstatusline') + call writefile(lines, 'Xsearchstatusline', 'D') let buf = RunVimInTerminal('-S Xsearchstatusline', #{rows: 10}) call TermWait(buf) call term_sendkeys(buf, "/something") @@ -316,7 +316,6 @@ func Test_searchcount_in_statusline() call term_sendkeys(buf, "\") call StopVimInTerminal(buf) - call delete('Xsearchstatusline') endfunc func Test_search_stat_foldopen() @@ -330,7 +329,7 @@ func Test_search_stat_foldopen() call cursor(1,1) norm n END - call writefile(lines, 'Xsearchstat1') + call writefile(lines, 'Xsearchstat1', 'D') let buf = RunVimInTerminal('-S Xsearchstat1', #{rows: 10}) call VerifyScreenDump(buf, 'Test_searchstat_3', {}) @@ -342,7 +341,6 @@ func Test_search_stat_foldopen() call VerifyScreenDump(buf, 'Test_searchstat_3', {}) call StopVimInTerminal(buf) - call delete('Xsearchstat1') endfunc func! Test_search_stat_screendump() @@ -359,7 +357,7 @@ func! Test_search_stat_screendump() call cursor(1,1) norm n END - call writefile(lines, 'Xsearchstat') + call writefile(lines, 'Xsearchstat', 'D') let buf = RunVimInTerminal('-S Xsearchstat', #{rows: 10}) call VerifyScreenDump(buf, 'Test_searchstat_1', {}) @@ -368,7 +366,6 @@ func! Test_search_stat_screendump() call VerifyScreenDump(buf, 'Test_searchstat_2', {}) call StopVimInTerminal(buf) - call delete('Xsearchstat') endfunc func Test_search_stat_then_gd() @@ -379,7 +376,7 @@ func Test_search_stat_then_gd() set shortmess-=S set hlsearch END - call writefile(lines, 'Xsearchstatgd') + call writefile(lines, 'Xsearchstatgd', 'D') let buf = RunVimInTerminal('-S Xsearchstatgd', #{rows: 10}) call term_sendkeys(buf, "/dog\") @@ -389,7 +386,6 @@ func Test_search_stat_then_gd() call VerifyScreenDump(buf, 'Test_searchstatgd_2', {}) call StopVimInTerminal(buf) - call delete('Xsearchstatgd') endfunc func Test_search_stat_and_incsearch() diff --git a/test/old/testdir/test_shell.vim b/test/old/testdir/test_shell.vim index c2320d8f39..9499462a70 100644 --- a/test/old/testdir/test_shell.vim +++ b/test/old/testdir/test_shell.vim @@ -188,7 +188,7 @@ func Test_shellxquote() let save_sxq = &shellxquote let save_sxe = &shellxescape - call writefile(['#!/bin/sh', 'echo "Cmd: [$*]" > Xlog'], 'Xtestshell') + call writefile(['#!/bin/sh', 'echo "Cmd: [$*]" > Xlog'], 'Xtestshell', 'D') call setfperm('Xtestshell', "r-x------") set shell=./Xtestshell @@ -212,7 +212,6 @@ func Test_shellxquote() let &shell = save_shell let &shellxquote = save_sxq let &shellxescape = save_sxe - call delete('Xtestshell') call delete('Xlog') endfunc diff --git a/test/old/testdir/test_signals.vim b/test/old/testdir/test_signals.vim index 3ec4b975e1..af4847e42c 100644 --- a/test/old/testdir/test_signals.vim +++ b/test/old/testdir/test_signals.vim @@ -118,7 +118,7 @@ func Test_signal_TSTP() au VimSuspend * call writefile(["VimSuspend triggered"], "XautoOut1", "as") au VimResume * call writefile(["VimResume triggered"], "XautoOut2", "as") END - call writefile(lines, 'XsetupAucmd') + call writefile(lines, 'XsetupAucmd', 'D') let buf = RunVimInTerminal('-S XsetupAucmd Xsig_TERM', {'rows': 6}) let pid_vim = term_getjob(buf)->job_info().process @@ -148,7 +148,6 @@ func Test_signal_TSTP() %bwipe! call delete('.Xsig_TERM.swp') - call delete('XsetupAucmd') call delete('XautoOut1') call delete('XautoOut2') endfunc @@ -177,7 +176,7 @@ func Test_deadly_signal_TERM() au VimLeave * call writefile(["VimLeave triggered"], "XautoOut", "as") au VimLeavePre * call writefile(["VimLeavePre triggered"], "XautoOut", "as") END - call writefile(lines, 'XsetupAucmd') + call writefile(lines, 'XsetupAucmd', 'D') let buf = RunVimInTerminal('-S XsetupAucmd Xsig_TERM', {'rows': 6}) let pid_vim = term_getjob(buf)->job_info().process @@ -201,7 +200,6 @@ func Test_deadly_signal_TERM() %bwipe! call delete('.Xsig_TERM.swp') - call delete('XsetupAucmd') call delete('XautoOut') endfunc diff --git a/test/old/testdir/test_signs.vim b/test/old/testdir/test_signs.vim index 1bb2ddd978..4bcf64fbba 100644 --- a/test/old/testdir/test_signs.vim +++ b/test/old/testdir/test_signs.vim @@ -254,8 +254,8 @@ func Test_sign_completion() \ 'SpellLocal SpellRare', @:) endfor - call writefile(repeat(["Sun is shining"], 30), "XsignOne") - call writefile(repeat(["Sky is blue"], 30), "XsignTwo") + call writefile(repeat(["Sun is shining"], 30), "XsignOne", 'D') + call writefile(repeat(["Sky is blue"], 30), "XsignTwo", 'D') call feedkeys(":sign define Sign icon=Xsig\\\"\", 'tx') call assert_equal('"sign define Sign icon=XsignOne XsignTwo', @:) @@ -332,8 +332,6 @@ func Test_sign_completion() sign undefine Sign1 sign undefine Sign2 enew - call delete('XsignOne') - call delete('XsignTwo') endfunc func Test_sign_invalid_commands() @@ -476,7 +474,7 @@ func Test_sign_funcs() call assert_fails('call sign_getdefined({})', 'E731:') " Tests for sign_place() - call writefile(repeat(["Sun is shining"], 30), "Xsign") + call writefile(repeat(["Sun is shining"], 30), "Xsign", 'D') edit Xsign call assert_equal(10, sign_place(10, '', 'sign1', 'Xsign', @@ -582,7 +580,6 @@ func Test_sign_funcs() \ 'priority' : 10}]}], \ sign_getplaced('%', {'lnum' : 22})) - call delete("Xsign") call sign_unplace('*') call sign_undefine() enew | only @@ -595,7 +592,7 @@ func Test_sign_group() call sign_unplace('*') call sign_undefine() - call writefile(repeat(["Sun is shining"], 30), "Xsign") + call writefile(repeat(["Sun is shining"], 30), "Xsign", 'D') let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'} call assert_equal(0, sign_define("sign1", attr)) @@ -836,7 +833,6 @@ func Test_sign_group() " Error cases call assert_fails("sign place 3 group= name=sign1 buffer=" . bnum, 'E474:') - call delete("Xsign") call sign_unplace('*') call sign_undefine() enew | only @@ -879,8 +875,8 @@ func Test_sign_unplace() call sign_undefine() " Create two files and define signs - call writefile(repeat(["Sun is shining"], 30), "Xsign1") - call writefile(repeat(["It is beautiful"], 30), "Xsign2") + call writefile(repeat(["Sun is shining"], 30), "Xsign1", 'D') + call writefile(repeat(["It is beautiful"], 30), "Xsign2", 'D') let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'} call sign_define("sign1", attr) @@ -1189,8 +1185,6 @@ func Test_sign_unplace() call sign_unplace('*') call sign_undefine() enew | only - call delete("Xsign1") - call delete("Xsign2") endfunc " Tests for auto-generating the sign identifier. @@ -1202,7 +1196,7 @@ func Test_aaa_sign_id_autogen() let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'} call assert_equal(0, sign_define("sign1", attr)) - call writefile(repeat(["Sun is shining"], 30), "Xsign") + call writefile(repeat(["Sun is shining"], 30), "Xsign", 'D') edit Xsign call assert_equal(1, sign_place(0, '', 'sign1', 'Xsign', @@ -1224,7 +1218,6 @@ func Test_aaa_sign_id_autogen() call assert_equal(10, \ sign_getplaced('Xsign', {'id' : 1})[0].signs[0].lnum) - call delete("Xsign") call sign_unplace('*') call sign_undefine() enew | only @@ -1820,7 +1813,7 @@ func Test_sign_cursor_position() redraw sign place 10 line=2 name=s1 END - call writefile(lines, 'XtestSigncolumn') + call writefile(lines, 'XtestSigncolumn', 'D') let buf = RunVimInTerminal('-S XtestSigncolumn', {'rows': 6}) call VerifyScreenDump(buf, 'Test_sign_cursor_1', {}) @@ -1840,7 +1833,6 @@ func Test_sign_cursor_position() " clean up call StopVimInTerminal(buf) - call delete('XtestSigncolumn') endfunc " Return the 'len' characters in screen starting from (row,col) @@ -1959,7 +1951,7 @@ endfunc " Test for managing multiple signs using the sign functions func Test_sign_funcs_multi() - call writefile(repeat(["Sun is shining"], 30), "Xsign") + call writefile(repeat(["Sun is shining"], 30), "Xsign", 'D') edit Xsign let bnum = bufnr('') @@ -2072,7 +2064,6 @@ func Test_sign_funcs_multi() call sign_unplace('*') call sign_undefine() enew! - call delete("Xsign") endfunc func Test_sign_null_list() diff --git a/test/old/testdir/test_sort.vim b/test/old/testdir/test_sort.vim index dafa3f618f..2d03dd2f2a 100644 --- a/test/old/testdir/test_sort.vim +++ b/test/old/testdir/test_sort.vim @@ -1525,11 +1525,10 @@ func Test_sort_with_no_last_search_pat() call writefile(v:errors, 'Xresult') qall! [SCRIPT] - call writefile(lines, 'Xscript') + call writefile(lines, 'Xscript', 'D') if RunVim([], [], '--clean -S Xscript') call assert_equal([], readfile('Xresult')) endif - call delete('Xscript') call delete('Xresult') endfunc diff --git a/test/old/testdir/test_source.vim b/test/old/testdir/test_source.vim index d4d96e36bf..01c08b183c 100644 --- a/test/old/testdir/test_source.vim +++ b/test/old/testdir/test_source.vim @@ -53,12 +53,10 @@ endfunc " When deleting a file and immediately creating a new one the inode may be " recycled. Vim should not recognize it as the same script. func Test_different_script() - call writefile(['let s:var = "asdf"'], 'XoneScript') + call writefile(['let s:var = "asdf"'], 'XoneScript', 'D') source XoneScript - call delete('XoneScript') - call writefile(['let g:var = s:var'], 'XtwoScript') + call writefile(['let g:var = s:var'], 'XtwoScript', 'D') call assert_fails('source XtwoScript', 'E121:') - call delete('XtwoScript') endfunc " When sourcing a vim script, shebang should be ignored. diff --git a/test/old/testdir/test_source_utf8.vim b/test/old/testdir/test_source_utf8.vim index 66fabe0442..f3e11a4bbc 100644 --- a/test/old/testdir/test_source_utf8.vim +++ b/test/old/testdir/test_source_utf8.vim @@ -42,7 +42,7 @@ func Test_source_ctrl_v() \ "map __3 asd\\", \ "map __4 asd\\\", \ "map __5 asd\\\", - \ ], 'Xtestfile') + \ ], 'Xtestfile', 'D') source Xtestfile enew! exe "normal __1\\__2\__3\\__4\__5\" @@ -52,7 +52,6 @@ func Test_source_ctrl_v() \ getline(1, 2)) enew! - call delete('Xtestfile') unmap __1 unmap __2 unmap __3 diff --git a/test/old/testdir/test_spell.vim b/test/old/testdir/test_spell.vim index 643744d817..bdd8a673fd 100644 --- a/test/old/testdir/test_spell.vim +++ b/test/old/testdir/test_spell.vim @@ -812,8 +812,8 @@ func Test_zz_sal_and_addition() throw 'skipped: Nvim does not support enc=latin1' set enc=latin1 set spellfile= - call writefile(g:test_data_dic1, "Xtest.dic") - call writefile(g:test_data_aff_sal, "Xtest.aff") + call writefile(g:test_data_dic1, "Xtest.dic", 'D') + call writefile(g:test_data_aff_sal, "Xtest.aff", 'D') mkspell! Xtest Xtest set spl=Xtest.latin1.spl spell call assert_equal('kbltykk', soundfold('goobledygoook')) @@ -821,7 +821,7 @@ func Test_zz_sal_and_addition() call assert_equal('*fls kswts tl', soundfold('oeverloos gezwets edale')) "also use an addition file - call writefile(["/regions=usgbnz", "elequint/2", "elekwint/3"], "Xtest.latin1.add") + call writefile(["/regions=usgbnz", "elequint/2", "elekwint/3"], "Xtest.latin1.add", 'D') mkspell! Xtest.latin1.add.spl Xtest.latin1.add bwipe! @@ -858,10 +858,9 @@ endfunc func Test_region_error() messages clear - call writefile(["/regions=usgbnz", "elequint/0"], "Xtest.latin1.add") + call writefile(["/regions=usgbnz", "elequint/0"], "Xtest.latin1.add", 'D') mkspell! Xtest.latin1.add.spl Xtest.latin1.add call assert_match('Invalid region nr in Xtest.latin1.add line 2: 0', execute('messages')) - call delete('Xtest.latin1.add') call delete('Xtest.latin1.add.spl') endfunc diff --git a/test/old/testdir/test_spell_utf8.vim b/test/old/testdir/test_spell_utf8.vim index 91ada1ed38..bb2c354a3d 100644 --- a/test/old/testdir/test_spell_utf8.vim +++ b/test/old/testdir/test_spell_utf8.vim @@ -726,8 +726,8 @@ endfunc " Test with SAL instead of SOFO items; test automatic reloading func Test_spell_sal_and_addition() set spellfile= - call writefile(g:test_data_dic1, "Xtest.dic") - call writefile(g:test_data_aff_sal, "Xtest.aff") + call writefile(g:test_data_dic1, "Xtest.dic", 'D') + call writefile(g:test_data_aff_sal, "Xtest.aff", 'D') mkspell! Xtest Xtest set spl=Xtest.utf-8.spl spell call assert_equal('kbltykk', soundfold('goobledygoook')) @@ -735,7 +735,7 @@ func Test_spell_sal_and_addition() call assert_equal('*fls kswts tl', soundfold('oeverloos gezwets edale')) "also use an addition file - call writefile(["/regions=usgbnz", "elequint/2", "elekwint/3"], "Xtest.utf-8.add") + call writefile(["/regions=usgbnz", "elequint/2", "elekwint/3"], "Xtest.utf-8.add", 'D') mkspell! Xtest.utf-8.add.spl Xtest.utf-8.add bwipe! diff --git a/test/old/testdir/test_spellfile.vim b/test/old/testdir/test_spellfile.vim index 50621144bd..09b69dd93c 100644 --- a/test/old/testdir/test_spellfile.vim +++ b/test/old/testdir/test_spellfile.vim @@ -212,7 +212,7 @@ endfunc " The spell file format is described in spellfile.c func Test_spellfile_format_error() let save_rtp = &rtp - call mkdir('Xtest/spell', 'p') + call mkdir('Xtest/spell', 'pR') let splfile = './Xtest/spell/Xtest.utf-8.spl' " empty spell file @@ -384,13 +384,12 @@ func Test_spellfile_format_error() call Spellfile_Test(0zFF00000000000000000000000201010000, 'E759:') let &rtp = save_rtp - call delete('Xtest', 'rf') endfunc " Test for format errors in suggest file func Test_sugfile_format_error() let save_rtp = &rtp - call mkdir('Xtest/spell', 'p') + call mkdir('Xtest/spell', 'pR') let splfile = './Xtest/spell/Xtest.utf-8.spl' let sugfile = './Xtest/spell/Xtest.utf-8.sug' @@ -473,7 +472,6 @@ func Test_sugfile_format_error() set nospell spelllang& let &rtp = save_rtp - call delete('Xtest', 'rf') endfunc " Test for using :mkspell to create a spell file from a list of words @@ -486,7 +484,7 @@ func Test_wordlist_dic() /encoding=latin1 example [END] - call writefile(lines, 'Xwordlist.dic') + call writefile(lines, 'Xwordlist.dic', 'D') let output = execute('mkspell Xwordlist.spl Xwordlist.dic') call assert_match('Duplicate /encoding= line ignored in Xwordlist.dic line 4: /encoding=latin1', output) @@ -559,7 +557,6 @@ func Test_wordlist_dic() call assert_match('Compressed keep-case:', output) call delete('Xwordlist.spl') - call delete('Xwordlist.dic') endfunc " Test for the :mkspell command @@ -600,8 +597,8 @@ func Test_aff_file_format_error() CheckNotMSWindows " No word count in .dic file - call writefile([], 'Xtest.dic') - call writefile([], 'Xtest.aff') + call writefile([], 'Xtest.dic', 'D') + call writefile([], 'Xtest.aff', 'D') call assert_fails('mkspell! Xtest.spl Xtest', 'E760:') " create a .dic file for the tests below @@ -823,20 +820,14 @@ func Test_aff_file_format_error() " use multiple .aff files with different values for COMPOUNDWORDMAX and " MIDWORD (number and string) - call writefile(['1', 'world'], 'Xtest_US.dic') - call writefile(['1', 'world'], 'Xtest_CA.dic') - call writefile(["COMPOUNDWORDMAX 3", "MIDWORD '-"], 'Xtest_US.aff') - call writefile(["COMPOUNDWORDMAX 4", "MIDWORD '="], 'Xtest_CA.aff') + call writefile(['1', 'world'], 'Xtest_US.dic', 'D') + call writefile(['1', 'world'], 'Xtest_CA.dic', 'D') + call writefile(["COMPOUNDWORDMAX 3", "MIDWORD '-"], 'Xtest_US.aff', 'D') + call writefile(["COMPOUNDWORDMAX 4", "MIDWORD '="], 'Xtest_CA.aff', 'D') let output = execute('mkspell! Xtest.spl Xtest_US Xtest_CA') call assert_match('COMPOUNDWORDMAX value differs from what is used in another .aff file', output) call assert_match('MIDWORD value differs from what is used in another .aff file', output) - call delete('Xtest_US.dic') - call delete('Xtest_CA.dic') - call delete('Xtest_US.aff') - call delete('Xtest_CA.aff') - call delete('Xtest.dic') - call delete('Xtest.aff') call delete('Xtest.spl') call delete('Xtest.sug') endfunc @@ -856,8 +847,8 @@ func Test_spell_add_word() endfunc func Test_spellfile_verbose() - call writefile(['1', 'one'], 'XtestVerbose.dic') - call writefile([], 'XtestVerbose.aff') + call writefile(['1', 'one'], 'XtestVerbose.dic', 'D') + call writefile([], 'XtestVerbose.aff', 'D') mkspell! XtestVerbose-utf8.spl XtestVerbose set spell @@ -870,15 +861,13 @@ func Test_spellfile_verbose() call assert_notmatch('Reading spell file "XtestVerbose-utf8.spl"', a) set spell& spelllang& - call delete('XtestVerbose.dic') - call delete('XtestVerbose.aff') call delete('XtestVerbose-utf8.spl') endfunc " Test NOBREAK (see :help spell-NOBREAK) func Test_NOBREAK() - call writefile(['3', 'one', 'two', 'three' ], 'XtestNOBREAK.dic') - call writefile(['NOBREAK' ], 'XtestNOBREAK.aff') + call writefile(['3', 'one', 'two', 'three' ], 'XtestNOBREAK.dic', 'D') + call writefile(['NOBREAK' ], 'XtestNOBREAK.aff', 'D') mkspell! XtestNOBREAK-utf8.spl XtestNOBREAK set spell spelllang=XtestNOBREAK-utf8.spl @@ -900,8 +889,6 @@ func Test_NOBREAK() bw! set spell& spelllang& - call delete('XtestNOBREAK.dic') - call delete('XtestNOBREAK.aff') call delete('XtestNOBREAK-utf8.spl') endfunc @@ -911,11 +898,11 @@ func Test_spellfile_CHECKCOMPOUNDPATTERN() \ 'one/c', \ 'two/c', \ 'three/c', - \ 'four'], 'XtestCHECKCOMPOUNDPATTERN.dic') + \ 'four'], 'XtestCHECKCOMPOUNDPATTERN.dic', 'D') " Forbid compound words where first word ends with 'wo' and second starts with 'on'. call writefile(['CHECKCOMPOUNDPATTERN 1', \ 'CHECKCOMPOUNDPATTERN wo on', - \ 'COMPOUNDFLAG c'], 'XtestCHECKCOMPOUNDPATTERN.aff') + \ 'COMPOUNDFLAG c'], 'XtestCHECKCOMPOUNDPATTERN.aff', 'D') mkspell! XtestCHECKCOMPOUNDPATTERN-utf8.spl XtestCHECKCOMPOUNDPATTERN set spell spelllang=XtestCHECKCOMPOUNDPATTERN-utf8.spl @@ -939,8 +926,6 @@ func Test_spellfile_CHECKCOMPOUNDPATTERN() endfor set spell& spelllang& - call delete('XtestCHECKCOMPOUNDPATTERN.dic') - call delete('XtestCHECKCOMPOUNDPATTERN.aff') call delete('XtestCHECKCOMPOUNDPATTERN-utf8.spl') endfunc @@ -949,15 +934,15 @@ func Test_spellfile_NOCOMPOUNDSUGS() call writefile(['3', \ 'one/c', \ 'two/c', - \ 'three/c'], 'XtestNOCOMPOUNDSUGS.dic') + \ 'three/c'], 'XtestNOCOMPOUNDSUGS.dic', 'D') " pass 0 tests without NOCOMPOUNDSUGS, pass 1 tests with NOCOMPOUNDSUGS for pass in [0, 1] if pass == 0 - call writefile(['COMPOUNDFLAG c'], 'XtestNOCOMPOUNDSUGS.aff') + call writefile(['COMPOUNDFLAG c'], 'XtestNOCOMPOUNDSUGS.aff', 'D') else call writefile(['NOCOMPOUNDSUGS', - \ 'COMPOUNDFLAG c'], 'XtestNOCOMPOUNDSUGS.aff') + \ 'COMPOUNDFLAG c'], 'XtestNOCOMPOUNDSUGS.aff', 'D') endif mkspell! XtestNOCOMPOUNDSUGS-utf8.spl XtestNOCOMPOUNDSUGS @@ -985,8 +970,6 @@ func Test_spellfile_NOCOMPOUNDSUGS() endfor set spell& spelllang& - call delete('XtestNOCOMPOUNDSUGS.dic') - call delete('XtestNOCOMPOUNDSUGS.aff') call delete('XtestNOCOMPOUNDSUGS-utf8.spl') endfunc @@ -999,8 +982,8 @@ func Test_spellfile_COMMON() \ 'any', \ 'tee', \ 'the', - \ 'ted'], 'XtestCOMMON.dic') - call writefile(['COMMON the and'], 'XtestCOMMON.aff') + \ 'ted'], 'XtestCOMMON.dic', 'D') + call writefile(['COMMON the and'], 'XtestCOMMON.aff', 'D') mkspell! XtestCOMMON-utf8.spl XtestCOMMON set spell spelllang=XtestCOMMON-utf8.spl @@ -1012,15 +995,13 @@ func Test_spellfile_COMMON() call assert_equal(['the', 'tee'], spellsuggest('dhe', 2)) set spell& spelllang& - call delete('XtestCOMMON.dic') - call delete('XtestCOMMON.aff') call delete('XtestCOMMON-utf8.spl') endfunc " Test NOSUGGEST (see :help spell-COMMON) func Test_spellfile_NOSUGGEST() - call writefile(['2', 'foo/X', 'fog'], 'XtestNOSUGGEST.dic') - call writefile(['NOSUGGEST X'], 'XtestNOSUGGEST.aff') + call writefile(['2', 'foo/X', 'fog'], 'XtestNOSUGGEST.dic', 'D') + call writefile(['NOSUGGEST X'], 'XtestNOSUGGEST.aff', 'D') mkspell! XtestNOSUGGEST-utf8.spl XtestNOSUGGEST set spell spelllang=XtestNOSUGGEST-utf8.spl @@ -1038,8 +1019,6 @@ func Test_spellfile_NOSUGGEST() call assert_equal(['fog'], spellsuggest('fogg', 1)) set spell& spelllang& - call delete('XtestNOSUGGEST.dic') - call delete('XtestNOSUGGEST.aff') call delete('XtestNOSUGGEST-utf8.spl') endfunc @@ -1048,7 +1027,7 @@ endfunc func Test_spellfile_CIRCUMFIX() " Example taken verbatim from https://github.com/hunspell/hunspell/tree/master/tests call writefile(['1', - \ 'nagy/C po:adj'], 'XtestCIRCUMFIX.dic') + \ 'nagy/C po:adj'], 'XtestCIRCUMFIX.dic', 'D') call writefile(['# circumfixes: ~ obligate prefix/suffix combinations', \ '# superlative in Hungarian: leg- (prefix) AND -bb (suffix)', \ '', @@ -1063,7 +1042,7 @@ func Test_spellfile_CIRCUMFIX() \ 'SFX C Y 3', \ 'SFX C 0 obb . is:COMPARATIVE', \ 'SFX C 0 obb/AX . is:SUPERLATIVE', - \ 'SFX C 0 obb/BX . is:SUPERSUPERLATIVE'], 'XtestCIRCUMFIX.aff') + \ 'SFX C 0 obb/BX . is:SUPERSUPERLATIVE'], 'XtestCIRCUMFIX.aff', 'D') mkspell! XtestCIRCUMFIX-utf8.spl XtestCIRCUMFIX set spell spelllang=XtestCIRCUMFIX-utf8.spl @@ -1082,8 +1061,6 @@ func Test_spellfile_CIRCUMFIX() endfor set spell& spelllang& - call delete('XtestCIRCUMFIX.dic') - call delete('XtestCIRCUMFIX.aff') call delete('XtestCIRCUMFIX-utf8.spl') endfunc @@ -1095,12 +1072,12 @@ func Test_spellfile_SFX_strip() \ 'SFX A are hiamo [cg]are', \ 'SFX A re mo iare', \ 'SFX A re vamo are'], - \ 'XtestSFX.aff') + \ 'XtestSFX.aff', 'D') " Examples of Italian verbs: " - cantare = to sing " - cercare = to search " - odiare = to hate - call writefile(['3', 'cantare/A', 'cercare/A', 'odiare/A'], 'XtestSFX.dic') + call writefile(['3', 'cantare/A', 'cercare/A', 'odiare/A'], 'XtestSFX.dic', 'D') mkspell! XtestSFX-utf8.spl XtestSFX set spell spelllang=XtestSFX-utf8.spl @@ -1124,8 +1101,6 @@ func Test_spellfile_SFX_strip() call assert_equal(['odiamo'], spellsuggest('odiiamo', 1)) set spell& spelllang& - call delete('XtestSFX.dic') - call delete('XtestSFX.aff') call delete('XtestSFX-utf8.spl') endfunc @@ -1134,7 +1109,7 @@ endfunc func Test_init_spellfile() let save_rtp = &rtp let save_encoding = &encoding - call mkdir('Xrtp/spell', 'p') + call mkdir('Xrtp/spell', 'pR') call writefile(['vim'], 'Xrtp/spell/Xtest.dic') silent mkspell Xrtp/spell/Xtest.utf-8.spl Xrtp/spell/Xtest.dic set runtimepath=./Xrtp @@ -1144,8 +1119,8 @@ func Test_init_spellfile() call assert_equal('./Xrtp/spell/Xtest.utf-8.add', &spellfile) call assert_equal(['abc'], readfile('Xrtp/spell/Xtest.utf-8.add')) call assert_true(filereadable('Xrtp/spell/Xtest.utf-8.spl')) + set spell& spelllang& spellfile& - call delete('Xrtp', 'rf') let &encoding = save_encoding let &rtp = save_rtp %bw! @@ -1171,12 +1146,10 @@ endfunc " this was using a NULL pointer func Test_mkspell_empty_dic() - call writefile(['1'], 'XtestEmpty.dic') - call writefile(['SOFOFROM abcd', 'SOFOTO ABCD', 'SAL CIA X'], 'XtestEmpty.aff') + call writefile(['1'], 'XtestEmpty.dic', 'D') + call writefile(['SOFOFROM abcd', 'SOFOTO ABCD', 'SAL CIA X'], 'XtestEmpty.aff', 'D') mkspell! XtestEmpty.spl XtestEmpty - call delete('XtestEmpty.dic') - call delete('XtestEmpty.aff') call delete('XtestEmpty.spl') endfunc diff --git a/test/old/testdir/test_startup_utf8.vim b/test/old/testdir/test_startup_utf8.vim index 1684d80c80..e8b99e7937 100644 --- a/test/old/testdir/test_startup_utf8.vim +++ b/test/old/testdir/test_startup_utf8.vim @@ -6,7 +6,7 @@ source screendump.vim func Test_read_stdin_utf8() let linesin = ['テスト', '€ÀÈÌÒÙ'] - call writefile(linesin, 'Xtestin') + call writefile(linesin, 'Xtestin', 'D') let before = [ \ 'set enc=utf-8', \ 'set fencs=cp932,utf-8', @@ -26,24 +26,22 @@ func Test_read_stdin_utf8() else call assert_equal('', 'RunVimPiped failed.') endif + call delete('Xtestout') - call delete('Xtestin') endfunc func Test_read_fifo_utf8() - if !has('unix') - return - endif + CheckUnix " Using bash/zsh's process substitution. if executable('bash') set shell=bash elseif executable('zsh') set shell=zsh else - return + throw 'Skipped: bash or zsh is required' endif let linesin = ['テスト', '€ÀÈÌÒÙ'] - call writefile(linesin, 'Xtestin') + call writefile(linesin, 'Xtestin', 'D') let before = [ \ 'set enc=utf-8', \ 'set fencs=cp932,utf-8', @@ -58,8 +56,8 @@ func Test_read_fifo_utf8() else call assert_equal('', 'RunVim failed.') endif + call delete('Xtestout') - call delete('Xtestin') endfunc func Test_detect_ambiwidth() @@ -71,12 +69,13 @@ func Test_detect_ambiwidth() \ 'set ambiwidth=double', \ 'call test_option_not_set("ambiwidth")', \ 'redraw', - \ ], 'Xscript') + \ ], 'Xscript', 'D') let buf = RunVimInTerminal('-S Xscript', #{keep_t_u7: 1}) call TermWait(buf) call term_sendkeys(buf, "S\=&ambiwidth\\") call WaitForAssert({-> assert_match('single', term_getline(buf, 1))}) call StopVimInTerminal(buf) - call delete('Xscript') endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_stat.vim b/test/old/testdir/test_stat.vim index 13ade5bee1..b9fd7f5f28 100644 --- a/test/old/testdir/test_stat.vim +++ b/test/old/testdir/test_stat.vim @@ -63,7 +63,7 @@ func Test_checktime() let fname = 'Xtest.tmp' let fl = ['Hello World!'] - call writefile(fl, fname) + call writefile(fl, fname, 'D') set autoread exec 'e' fname call SleepForTimestamp() @@ -72,8 +72,6 @@ func Test_checktime() call writefile(fl, fname) checktime call assert_equal(fl[0], getline(1)) - - call delete(fname) endfunc func Test_checktime_fast() @@ -82,7 +80,7 @@ func Test_checktime_fast() let fname = 'Xtest.tmp' let fl = ['Hello World!'] - call writefile(fl, fname) + call writefile(fl, fname, 'D') set autoread exec 'e' fname let fl = readfile(fname) @@ -91,8 +89,6 @@ func Test_checktime_fast() call writefile(fl, fname) checktime call assert_equal(fl[0], getline(1)) - - call delete(fname) endfunc func Test_autoread_fast() @@ -106,12 +102,10 @@ func Test_autoread_fast() call setline(1, 'foo') w! sleep 10m - call writefile(['bar'], 'Xautoread') + call writefile(['bar'], 'Xautoread', 'D') sleep 10m checktime call assert_equal('bar', trim(getline(1))) - - call delete('Xautoread') endfunc func Test_autoread_file_deleted() diff --git a/test/old/testdir/test_statusline.vim b/test/old/testdir/test_statusline.vim index c48bac12b4..f8c326bb41 100644 --- a/test/old/testdir/test_statusline.vim +++ b/test/old/testdir/test_statusline.vim @@ -483,14 +483,13 @@ func Test_statusline_removed_group() set laststatus=2 let &statusline = '%#StatColorHi2#%(✓%#StatColorHi2#%) Q≡' END - call writefile(lines, 'XTest_statusline') + call writefile(lines, 'XTest_statusline', 'D') let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 10, 'cols': 50}) call VerifyScreenDump(buf, 'Test_statusline_1', {}) " clean up call StopVimInTerminal(buf) - call delete('XTest_statusline') endfunc func Test_statusline_using_mode() @@ -501,7 +500,7 @@ func Test_statusline_using_mode() split setlocal statusline=+%{mode()}+ END - call writefile(lines, 'XTest_statusline') + call writefile(lines, 'XTest_statusline', 'D') let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 7, 'cols': 50}) call VerifyScreenDump(buf, 'Test_statusline_mode_1', {}) @@ -512,7 +511,6 @@ func Test_statusline_using_mode() " clean up call term_sendkeys(buf, "close\") call StopVimInTerminal(buf) - call delete('XTest_statusline') endfunc func Test_statusline_after_split_vsplit() @@ -567,13 +565,12 @@ func Test_statusline_highlight_truncate() hi! link User2 ErrorMsg set statusline=%.5(%1*ABC%2*DEF%1*GHI%) END - call writefile(lines, 'XTest_statusline') + call writefile(lines, 'XTest_statusline', 'D') let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 6}) call VerifyScreenDump(buf, 'Test_statusline_hl', {}) call StopVimInTerminal(buf) - call delete('XTest_statusline') endfunc func Test_statusline_showcmd() diff --git a/test/old/testdir/test_substitute.vim b/test/old/testdir/test_substitute.vim index fdb0f6fc37..a8f2d99f50 100644 --- a/test/old/testdir/test_substitute.vim +++ b/test/old/testdir/test_substitute.vim @@ -892,7 +892,7 @@ func Test_sub_with_no_last_pat() call writefile(v:errors, 'Xresult') qall! [SCRIPT] - call writefile(lines, 'Xscript') + call writefile(lines, 'Xscript', 'D') if RunVim([], [], '--clean -S Xscript') call assert_equal([], readfile('Xresult')) endif @@ -909,7 +909,6 @@ func Test_sub_with_no_last_pat() " call assert_equal([], readfile('Xresult')) " endif - call delete('Xscript') call delete('Xresult') endfunc @@ -1110,13 +1109,12 @@ func Test_sub_open_cmdline_win() redir END qall! [SCRIPT] - call writefile(lines, 'Xscript') + call writefile(lines, 'Xscript', 'D') if RunVim([], [], '-u NONE -S Xscript') call assert_match('E565: Not allowed to change text or change window', \ readfile('Xresult')->join('XX')) endif - call delete('Xscript') call delete('Xresult') endfunc diff --git a/test/old/testdir/test_swap.vim b/test/old/testdir/test_swap.vim index 65b6c57850..7c84c47337 100644 --- a/test/old/testdir/test_swap.vim +++ b/test/old/testdir/test_swap.vim @@ -10,14 +10,13 @@ endfunc " Tests for 'directory' option. func Test_swap_directory() - if !has("unix") - return - endif + CheckUnix + let content = ['start of testfile', \ 'line 2 Abcdefghij', \ 'line 3 Abcdefghij', \ 'end of testfile'] - call writefile(content, 'Xtest1') + call writefile(content, 'Xtest1', 'D') " '.', swap file in the same directory as file set dir=.,~ @@ -31,7 +30,7 @@ func Test_swap_directory() " './dir', swap file in a directory relative to the file set dir=./Xtest2,.,~ - call mkdir("Xtest2") + call mkdir("Xtest2", 'R') edit Xtest1 call assert_equal([], glob(swfname, 1, 1, 1)) let swfname = "Xtest2/Xtest1.swp" @@ -41,7 +40,7 @@ func Test_swap_directory() " 'dir', swap file in directory relative to the current dir set dir=Xtest.je,~ - call mkdir("Xtest.je") + call mkdir("Xtest.je", 'R') call writefile(content, 'Xtest2/Xtest3') edit Xtest2/Xtest3 call assert_equal(["Xtest2/Xtest3"], glob("Xtest2/*", 1, 1, 1)) @@ -50,15 +49,11 @@ func Test_swap_directory() call assert_equal([swfname], glob("Xtest.je/*", 1, 1, 1)) set dir& - call delete("Xtest1") - call delete("Xtest2", "rf") - call delete("Xtest.je", "rf") endfunc func Test_swap_group() - if !has("unix") - return - endif + CheckUnix + let groups = split(system('groups')) if len(groups) <= 1 throw 'Skipped: need at least two groups, got ' . string(groups) @@ -148,7 +143,7 @@ func Test_swapinfo() let info = swapinfo('doesnotexist') call assert_equal('Cannot open file', info.error) - call writefile(['burp'], 'Xnotaswapfile') + call writefile(['burp'], 'Xnotaswapfile', 'D') let info = swapinfo('Xnotaswapfile') call assert_equal('Cannot read file', info.error) call delete('Xnotaswapfile') @@ -156,7 +151,6 @@ func Test_swapinfo() call writefile([repeat('x', 10000)], 'Xnotaswapfile') let info = swapinfo('Xnotaswapfile') call assert_equal('Not a swap file', info.error) - call delete('Xnotaswapfile') endfunc func Test_swapname() @@ -204,7 +198,7 @@ func Test_swapfile_delete() " Close the file and recreate the swap file. " Now editing the file will run into the process still existing quit - call writefile(swapfile_bytes, swapfile_name) + call writefile(swapfile_bytes, swapfile_name, 'D') let s:swap_choice = 'e' let s:swapname = '' split XswapfileText @@ -232,7 +226,6 @@ func Test_swapfile_delete() call assert_equal(fnamemodify(swapfile_name, ':t'), fnamemodify(s:swapname, ':t')) call delete('XswapfileText') - call delete(swapfile_name) augroup test_swapfile_delete autocmd! augroup END @@ -246,7 +239,7 @@ func Test_swap_recover() autocmd SwapExists * let v:swapchoice = 'r' augroup END - call mkdir('Xswap') + call mkdir('Xswap', 'R') let $Xswap = 'foo' " Check for issue #4369. set dir=Xswap// " Create a valid swapfile by editing a file. @@ -259,7 +252,7 @@ func Test_swap_recover() " Close the file and recreate the swap file. quit - call writefile(swapfile_bytes, swapfile_name) + call writefile(swapfile_bytes, swapfile_name, 'D') " Edit the file again. This triggers recovery. try split Xswap/text @@ -271,9 +264,6 @@ func Test_swap_recover() call assert_equal(['one', 'two', 'three'], getline(1, 3)) quit! - call delete('Xswap/text') - call delete(swapfile_name) - call delete('Xswap', 'd') unlet $Xswap set dir& augroup test_swap_recover @@ -301,7 +291,7 @@ func Test_swap_recover_ext() " Close and delete the file and recreate the swap file. quit call delete('Xtest.scr') - call writefile(swapfile_bytes, swapfile_name) + call writefile(swapfile_bytes, swapfile_name, 'D') " Edit the file again. This triggers recovery. try split Xtest.scr @@ -314,7 +304,6 @@ func Test_swap_recover_ext() quit! call delete('Xtest.scr') - call delete(swapfile_name) augroup test_swap_recover_ext autocmd! augroup END @@ -342,7 +331,7 @@ func Test_swap_split_win() " Close and delete the file and recreate the swap file. quit call delete('Xtest.scr') - call writefile(swapfile_bytes, swapfile_name) + call writefile(swapfile_bytes, swapfile_name, 'D') " Split edit the file again. This should fail to open the window try split Xtest.scr @@ -353,7 +342,6 @@ func Test_swap_split_win() call assert_equal(1, winnr('$')) call delete('Xtest.scr') - call delete(swapfile_name) augroup test_swap_splitwin autocmd! @@ -365,7 +353,7 @@ endfunc func Test_swap_prompt_splitwin() CheckRunVimInTerminal - call writefile(['foo bar'], 'Xfile1') + call writefile(['foo bar'], 'Xfile1', 'D') edit Xfile1 preserve " should help to make sure the swap file exists @@ -400,13 +388,12 @@ func Test_swap_prompt_splitwin() call StopVimInTerminal(buf) %bwipe! - call delete('Xfile1') endfunc func Test_swap_symlink() CheckUnix - call writefile(['text'], 'Xtestfile') + call writefile(['text'], 'Xtestfile', 'D') silent !ln -s -f Xtestfile Xtestlink set dir=. @@ -417,7 +404,7 @@ func Test_swap_symlink() call assert_match('Xtestfile\.swp$', s:swapname()) bwipe! - call mkdir('Xswapdir') + call mkdir('Xswapdir', 'R') exe 'set dir=' . getcwd() . '/Xswapdir//' " Check that this also works when 'directory' ends with '//' @@ -426,9 +413,7 @@ func Test_swap_symlink() bwipe! set dir& - call delete('Xtestfile') call delete('Xtestlink') - call delete('Xswapdir', 'rf') endfunc func s:get_unused_pid(base) @@ -486,7 +471,7 @@ func Test_swap_auto_delete() " Change the process ID to avoid the "still running" warning. let swapfile_bytes[24:27] = s:pid_to_blob(s:get_unused_pid( \ s:blob_to_pid(swapfile_bytes[24:27]))) - call writefile(swapfile_bytes, swapfile_name) + call writefile(swapfile_bytes, swapfile_name, 'D') edit Xtest.scr " will end up using the same swap file after deleting the existing one call assert_equal(swapfile_name, swapname('%')) @@ -510,7 +495,6 @@ func Test_swap_auto_delete() bwipe! call delete('Xtest.scr') - call delete(swapfile_name) augroup test_swap_recover_ext autocmd! augroup END @@ -539,13 +523,13 @@ endfunc " Test for the v:swapchoice variable func Test_swapchoice() - call writefile(['aaa', 'bbb'], 'Xfile5') + call writefile(['aaa', 'bbb'], 'Xfile5', 'D') edit Xfile5 preserve let swapfname = swapname('') let b = readblob(swapfname) bw! - call writefile(b, swapfname) + call writefile(b, swapfname, 'D') autocmd! SwapExists @@ -584,7 +568,6 @@ func Test_swapchoice() %bw! call assert_false(filereadable(swapfname)) - call delete('Xfile5') call delete(swapfname) augroup test_swapchoice autocmd! diff --git a/test/old/testdir/test_syntax.vim b/test/old/testdir/test_syntax.vim index 8a24c4ae27..207efb6223 100644 --- a/test/old/testdir/test_syntax.vim +++ b/test/old/testdir/test_syntax.vim @@ -644,15 +644,16 @@ func Test_syntax_c() \ ' printf("Just an example piece of C code\n");', \ ' return 0x0ff;', \ '}', + \ "\t\t ", \ ' static void', \ 'myFunction(const double count, struct nothing, long there) {', - \ ' // 123: nothing to read here', - \ ' for (int i = 0; i < count; ++i) {', - \ ' break;', - \ ' }', - \ " Note: asdf", + \ "\t// 123: nothing to endif here", + \ "\tfor (int i = 0; i < count; ++i) {", + \ "\t break;", + \ "\t}", + \ "\tNote: asdf", \ '}', - \ ], 'Xtest.c') + \ ], 'Xtest.c', 'D') " This makes the default for 'background' use "dark", check that the " response to t_RB corrects it to "light". @@ -664,7 +665,6 @@ func Test_syntax_c() call StopVimInTerminal(buf) let $COLORFGBG = '' - call delete('Xtest.c') endfun " Test \z(...) along with \z1 @@ -698,10 +698,10 @@ func Test_syn_wrong_z_one() endfunc func Test_syntax_after_bufdo() - call writefile(['/* aaa comment */'], 'Xaaa.c') - call writefile(['/* bbb comment */'], 'Xbbb.c') - call writefile(['/* ccc comment */'], 'Xccc.c') - call writefile(['/* ddd comment */'], 'Xddd.c') + call writefile(['/* aaa comment */'], 'Xaaa.c', 'D') + call writefile(['/* bbb comment */'], 'Xbbb.c', 'D') + call writefile(['/* ccc comment */'], 'Xccc.c', 'D') + call writefile(['/* ddd comment */'], 'Xddd.c', 'D') let bnr = bufnr('%') new Xaaa.c @@ -729,10 +729,6 @@ func Test_syntax_after_bufdo() bwipe! Xccc.c bwipe! Xddd.c syntax off - call delete('Xaaa.c') - call delete('Xbbb.c') - call delete('Xccc.c') - call delete('Xddd.c') endfunc func Test_syntax_foldlevel() diff --git a/test/old/testdir/test_system.vim b/test/old/testdir/test_system.vim index 6c8373b335..30fab6d55f 100644 --- a/test/old/testdir/test_system.vim +++ b/test/old/testdir/test_system.vim @@ -53,7 +53,7 @@ func Test_system_exmode() let cmd = ' -es -c "source Xscript" +q; echo "result=$?"' " Need to put this in a script, "catch" isn't found after an unknown " function. - call writefile(['try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript') + call writefile(['try', 'call doesnotexist()', 'catch', 'endtry'], 'Xscript', 'D') let a = system(GetVimCommand() . cmd) call assert_match('result=0', a) call assert_equal(0, v:shell_error) @@ -69,7 +69,6 @@ func Test_system_exmode() let cmd = ' -es -c "source Xscript" +q' let a = system(GetVimCommand() . cmd) call assert_notequal(0, v:shell_error) - call delete('Xscript') if has('unix') " echo $? only works on Unix let cmd = ' -es -c "call doesnotexist()" +q; echo $?' -- cgit From 457ab65ff3f7a7d3eecb45d4f3b48ab8a0295e52 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 17 Jul 2024 10:19:31 +0800 Subject: vim-patch:9.0.1257: code style is not check in test scripts Problem: Code style is not check in test scripts. Solution: Add basic code style check for test files. https://github.com/vim/vim/commit/94722c510745a0cfd494c51625a514b92dd2bfb2 Use Test_test_files() from latest Vim. Co-authored-by: Bram Moolenaar --- test/old/testdir/runtest.vim | 12 ++- test/old/testdir/summarize.vim | 2 +- test/old/testdir/test_autocmd.vim | 6 +- test/old/testdir/test_blob.vim | 2 +- test/old/testdir/test_blockedit.vim | 2 +- test/old/testdir/test_codestyle.vim | 39 +++++++ test/old/testdir/test_diffmode.vim | 8 +- test/old/testdir/test_edit.vim | 2 +- test/old/testdir/test_expand_func.vim | 6 +- test/old/testdir/test_fold.vim | 4 +- test/old/testdir/test_goto.vim | 34 +++--- test/old/testdir/test_increment.vim | 2 +- test/old/testdir/test_indent.vim | 6 +- test/old/testdir/test_ins_complete.vim | 2 +- test/old/testdir/test_map_functions.vim | 2 +- test/old/testdir/test_method.vim | 2 +- test/old/testdir/test_popup.vim | 8 +- test/old/testdir/test_quickfix.vim | 180 ++++++++++++++++---------------- test/old/testdir/test_regexp_latin.vim | 2 +- test/old/testdir/test_scroll_opt.vim | 14 +-- test/old/testdir/test_signals.vim | 2 +- test/old/testdir/test_signs.vim | 6 +- test/old/testdir/test_statusline.vim | 2 +- test/old/testdir/test_substitute.vim | 2 +- test/old/testdir/test_tagfunc.vim | 4 +- test/old/testdir/test_tagjump.vim | 2 +- test/old/testdir/test_timers.vim | 11 +- test/old/testdir/test_true_false.vim | 13 ++- test/old/testdir/test_utf8.vim | 4 +- test/old/testdir/test_virtualedit.vim | 4 +- test/old/testdir/test_visual.vim | 18 ++-- test/old/testdir/test_winbuf_close.vim | 2 +- 32 files changed, 229 insertions(+), 176 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/runtest.vim b/test/old/testdir/runtest.vim index 362964c5cb..e05a78e9ca 100644 --- a/test/old/testdir/runtest.vim +++ b/test/old/testdir/runtest.vim @@ -48,8 +48,18 @@ " call add(v:errors, "this happened") +" Without the +eval feature we can't run these tests, bail out. +silent! while 0 + qa! +silent! endwhile + +" In the GUI we can always change the screen size. +if has('gui_running') + set columns=80 lines=25 +endif + " Check that the screen size is at least 24 x 80 characters. -if &lines < 24 || &columns < 80 +if &lines < 24 || &columns < 80 let error = 'Screen size too small! Tests require at least 24 lines with 80 characters, got ' .. &lines .. ' lines with ' .. &columns .. ' characters' echoerr error split test.log diff --git a/test/old/testdir/summarize.vim b/test/old/testdir/summarize.vim index da5856a2e7..d0d4e00b2c 100644 --- a/test/old/testdir/summarize.vim +++ b/test/old/testdir/summarize.vim @@ -33,7 +33,7 @@ if 1 silent %s/^SKIPPED \zs.*/\=Count(submatch(0), 'skipped')/egn silent %s/^\(\d\+\)\s\+FAILED:/\=Count(submatch(1), 'failed')/egn - call extend(output, ["Skipped:"]) + call extend(output, ["Skipped:"]) call extend(output, skipped_output) call extend(output, [ diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim index 862c48a1eb..68aa2834d8 100644 --- a/test/old/testdir/test_autocmd.vim +++ b/test/old/testdir/test_autocmd.vim @@ -273,8 +273,8 @@ func Test_win_tab_autocmd() augroup testing au WinNew * call add(g:record, 'WinNew') au WinClosed * call add(g:record, 'WinClosed') - au WinEnter * call add(g:record, 'WinEnter') - au WinLeave * call add(g:record, 'WinLeave') + au WinEnter * call add(g:record, 'WinEnter') + au WinLeave * call add(g:record, 'WinLeave') au TabNew * call add(g:record, 'TabNew') au TabClosed * call add(g:record, 'TabClosed') au TabEnter * call add(g:record, 'TabEnter') @@ -3770,7 +3770,7 @@ endfunc func Test_autocmd_split_dummy() " Autocommand trying to split a window containing a dummy buffer. - auto BufReadPre * exe "sbuf " .. expand("") + auto BufReadPre * exe "sbuf " .. expand("") " Avoid the "W11" prompt au FileChangedShell * let v:fcs_choice = 'reload' func Xautocmd_changelist() diff --git a/test/old/testdir/test_blob.vim b/test/old/testdir/test_blob.vim index 25b3c00dfc..3886be48bd 100644 --- a/test/old/testdir/test_blob.vim +++ b/test/old/testdir/test_blob.vim @@ -850,7 +850,7 @@ func Test_indexof() call assert_equal(-1, indexof(v:_null_blob, "v:val == 0xde")) call assert_equal(-1, indexof(b, v:_null_string)) " Nvim doesn't have null functions - " call assert_equal(-1, indexof(b, test_null_function())) + " call assert_equal(-1, indexof(b, test_null_function())) let b = 0z01020102 call assert_equal(1, indexof(b, "v:val == 0x02", #{startidx: 0})) diff --git a/test/old/testdir/test_blockedit.vim b/test/old/testdir/test_blockedit.vim index e0cfe11af0..c36ff74f29 100644 --- a/test/old/testdir/test_blockedit.vim +++ b/test/old/testdir/test_blockedit.vim @@ -53,7 +53,7 @@ func Test_blockinsert_autoindent() let expected =<< trim END vim9script var d = { - a: (): asdf => 0, + a: (): asdf => 0, b: (): asdf => 0, c: (): asdf => 0, } diff --git a/test/old/testdir/test_codestyle.vim b/test/old/testdir/test_codestyle.vim index 01dd03f693..a0cebf76d1 100644 --- a/test/old/testdir/test_codestyle.vim +++ b/test/old/testdir/test_codestyle.vim @@ -6,6 +6,45 @@ func s:ReportError(fname, lnum, msg) endif endfunc +func Test_test_files() + for fname in glob('*.vim', 0, 1) + let g:ignoreSwapExists = 'e' + exe 'edit ' .. fname + + " some files intentionally have misplaced white space + if fname =~ 'test_cindent.vim' || fname =~ 'test_join.vim' + continue + endif + + " skip files that are known to have a space before a tab + if fname !~ 'test_comments.vim' + \ && fname !~ 'test_listchars.vim' + \ && fname !~ 'test_visual.vim' + call cursor(1, 1) + let skip = 'getline(".") =~ "codestyle: ignore"' + let lnum = search(fname =~ "test_regexp_latin" ? '[^á] \t' : ' \t', 'W', 0, 0, skip) + call s:ReportError('testdir/' .. fname, lnum, 'space before Tab') + endif + + " skip files that are known to have trailing white space + if fname !~ 'test_cmdline.vim' + \ && fname !~ 'test_let.vim' + \ && fname !~ 'test_tagjump.vim' + \ && fname !~ 'test_vim9_cmd.vim' + call cursor(1, 1) + let lnum = search( + \ fname =~ 'test_vim9_assign.vim' ? '[^=]\s$' + \ : fname =~ 'test_vim9_class.vim' ? '[^)]\s$' + \ : fname =~ 'test_vim9_script.vim' ? '[^,:3]\s$' + \ : fname =~ 'test_visual.vim' ? '[^/]\s$' + \ : '[^\\]\s$') + call s:ReportError('testdir/' .. fname, lnum, 'trailing white space') + endif + endfor + + bwipe! +endfunc + func Test_help_files() set nowrapscan diff --git a/test/old/testdir/test_diffmode.vim b/test/old/testdir/test_diffmode.vim index 85ee5df961..31d66ebc4a 100644 --- a/test/old/testdir/test_diffmode.vim +++ b/test/old/testdir/test_diffmode.vim @@ -1332,12 +1332,12 @@ endfunc func Test_diff_and_scroll() " this was causing an ml_get error set ls=2 - for i in range(winheight(0) * 2) - call setline(i, i < winheight(0) - 10 ? i : i + 10) + for i in range(winheight(0) * 2) + call setline(i, i < winheight(0) - 10 ? i : i + 10) endfor vnew - for i in range(winheight(0)*2 + 10) - call setline(i, i < winheight(0) - 10 ? 0 : i) + for i in range(winheight(0)*2 + 10) + call setline(i, i < winheight(0) - 10 ? 0 : i) endfor diffthis wincmd p diff --git a/test/old/testdir/test_edit.vim b/test/old/testdir/test_edit.vim index 57ff63f26d..d43dcc40c1 100644 --- a/test/old/testdir/test_edit.vim +++ b/test/old/testdir/test_edit.vim @@ -2112,7 +2112,7 @@ func Test_edit_overlong_file_name() file %%%%%%%%%%%%%%%%%%%%%%%%%% file %%%%%% set readonly - set ls=2 + set ls=2 redraw! set noreadonly ls& diff --git a/test/old/testdir/test_expand_func.vim b/test/old/testdir/test_expand_func.vim index 454d76f0aa..12750baf67 100644 --- a/test/old/testdir/test_expand_func.vim +++ b/test/old/testdir/test_expand_func.vim @@ -7,15 +7,15 @@ let s:slnum = str2nr(expand('')) let s:sflnum = str2nr(expand('')) func s:expand_sfile() - return expand('') + return expand('') endfunc func s:expand_slnum() - return str2nr(expand('')) + return str2nr(expand('')) endfunc func s:expand_sflnum() - return str2nr(expand('')) + return str2nr(expand('')) endfunc " This test depends on the location in the test file, put it first. diff --git a/test/old/testdir/test_fold.vim b/test/old/testdir/test_fold.vim index b7a0cee444..829cfc674d 100644 --- a/test/old/testdir/test_fold.vim +++ b/test/old/testdir/test_fold.vim @@ -499,7 +499,7 @@ func Test_move_folds_around_manual() %foldopen! 13m7 call Check_foldlevels([1, 2, 2, 2, 1, 2, 2, 1, 1, 1, 2, 2, 2, 1, 0]) - + bw! endfunc @@ -748,7 +748,7 @@ func Test_fold_create_marker_in_C() let content =<< trim [CODE] /* * comment - * + * * */ int f(int* p) { diff --git a/test/old/testdir/test_goto.vim b/test/old/testdir/test_goto.vim index c5492ff97b..0d5de7235e 100644 --- a/test/old/testdir/test_goto.vim +++ b/test/old/testdir/test_goto.vim @@ -17,7 +17,7 @@ endfunc func Test_gD() let lines =<< trim [CODE] int x; - + int func(void) { return x; @@ -30,7 +30,7 @@ endfunc func Test_gD_too() let lines =<< trim [CODE] Filename x; - + int Filename int func() { Filename x; @@ -44,7 +44,7 @@ func Test_gD_comment() let lines =<< trim [CODE] /* int x; */ int x; - + int func(void) { return x; @@ -58,7 +58,7 @@ func Test_gD_inline_comment() let lines =<< trim [CODE] int y /* , x */; int x; - + int func(void) { return x; @@ -72,7 +72,7 @@ func Test_gD_string() let lines =<< trim [CODE] char *s[] = "x"; int x = 1; - + int func(void) { return x; @@ -85,7 +85,7 @@ endfunc func Test_gD_string_same_line() let lines =<< trim [CODE] char *s[] = "x", int x = 1; - + int func(void) { return x; @@ -99,7 +99,7 @@ func Test_gD_char() let lines =<< trim [CODE] char c = 'x'; int x = 1; - + int func(void) { return x; @@ -112,7 +112,7 @@ endfunc func Test_gd() let lines =<< trim [CODE] int x; - + int func(int x) { return x; @@ -146,7 +146,7 @@ func Test_gd_not_local() { return x; } - + int func2(int x) { return x; @@ -173,9 +173,9 @@ func Test_gd_missing_braces() def func1(a) a + 1 end - + a = 1 - + def func2() return a end @@ -252,11 +252,11 @@ func Test_gd_inline_comment_body() int func(void) { int y /* , x */; - + for (/* int x = 0 */; y < 2; y++); - + int x = 0; - + return x; } [CODE] @@ -292,7 +292,7 @@ func Test_gd_string() { char *s = "x"; int x = 1; - + return x; } [CODE] @@ -305,7 +305,7 @@ func Test_gd_string_only() int func(void) { char *s = "x"; - + return x; } [CODE] @@ -347,7 +347,7 @@ func Test_gd_local_block() char *b = "NULL"; return b; } - + return 0; } [CODE] diff --git a/test/old/testdir/test_increment.vim b/test/old/testdir/test_increment.vim index cf6334747a..5c61f25103 100644 --- a/test/old/testdir/test_increment.vim +++ b/test/old/testdir/test_increment.vim @@ -705,7 +705,7 @@ endfunc " Text: " 1 23 " 4 56 -" +" " Expected: " 1) f2 Ctrl-V jl , repeat twice afterwards with . " 1 26 diff --git a/test/old/testdir/test_indent.vim b/test/old/testdir/test_indent.vim index 3b5b643177..dcacc11663 100644 --- a/test/old/testdir/test_indent.vim +++ b/test/old/testdir/test_indent.vim @@ -176,7 +176,7 @@ func Test_modeline_indent_expr() endfunc func Test_indent_func_with_gq() - + function GetTeXIndent() " Sample indent expression for TeX files let lnum = prevnonblank(v:lnum - 1) @@ -187,7 +187,7 @@ func Test_indent_func_with_gq() let line = getline(lnum) let ind = indent(lnum) " Add a 'shiftwidth' after beginning of environments. - if line =~ '\\begin{center}' + if line =~ '\\begin{center}' let ind = ind + shiftwidth() endif return ind @@ -249,7 +249,7 @@ func Test_indent_func_with_gq() bwipe! delmark ab - delfunction GetTeXIndent + delfunction GetTeXIndent endfu func Test_formatting_keeps_first_line_indent() diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 0f974ebb5b..882e707f63 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2382,7 +2382,7 @@ endfunc func Test_ins_complete_end_of_line() " this was reading past the end of the line - new + new norm 8o€ý  sil! norm o diff --git a/test/old/testdir/test_map_functions.vim b/test/old/testdir/test_map_functions.vim index 0898242154..8f7c8bae76 100644 --- a/test/old/testdir/test_map_functions.vim +++ b/test/old/testdir/test_map_functions.vim @@ -20,7 +20,7 @@ func Test_maparg() call assert_equal({'silent': 0, 'noremap': 0, 'script': 0, 'lhs': 'foo', \ 'lhsraw': "foo\x80\xfc\x04V", 'lhsrawalt': "foo\x16", \ 'mode': ' ', 'nowait': 0, 'expr': 0, 'sid': sid, 'scriptversion': 1, - \ 'lnum': lnum + 1, + \ 'lnum': lnum + 1, \ 'rhs': 'isfoo', 'buffer': 0, 'abbr': 0, 'mode_bits': 0x47}, \ maparg('foo', '', 0, 1)) call assert_equal({'silent': 1, 'noremap': 1, 'script': 1, 'lhs': 'bar', diff --git a/test/old/testdir/test_method.vim b/test/old/testdir/test_method.vim index 88dbbd7bf4..0c1d15f4ed 100644 --- a/test/old/testdir/test_method.vim +++ b/test/old/testdir/test_method.vim @@ -128,7 +128,7 @@ endfunc func Test_method_syntax() eval [1, 2, 3] ->sort( ) - eval [1, 2, 3] + eval [1, 2, 3] \ ->sort( \ ) call assert_fails('eval [1, 2, 3]-> sort()', 'E15:') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 4960041452..20d96a99ea 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -16,7 +16,7 @@ func ListMonths() if !empty(entered) let mth = filter(mth, 'v:val=~"^".entered') endif - call complete(1, mth) + call complete(1, mth) return '' endfunc @@ -74,7 +74,7 @@ func Test_popup_complete() call feedkeys("aJu\\l\", 'tx') call assert_equal(["Jul"], getline(1,2)) %d - + " any-non printable, non-white character: Add this character and " reduce number of matches call feedkeys("aJu\\l\\", 'tx') @@ -96,7 +96,7 @@ func Test_popup_complete() call feedkeys("aJ\".repeat("\",3)."\\", 'tx') call assert_equal(["J "], getline(1,2)) %d - + " - Insert one character from the current match call feedkeys("aJ\".repeat("\",4)."\\", 'tx') call assert_equal(["January "], getline(1,2)) @@ -857,7 +857,7 @@ func Test_popup_position() call term_sendkeys(buf, "jI123456789_\") call term_sendkeys(buf, "GA\") call VerifyScreenDump(buf, 'Test_popup_position_04', {'rows': 10}) - + call term_sendkeys(buf, "\u") call StopVimInTerminal(buf) call delete('Xtest') diff --git a/test/old/testdir/test_quickfix.vim b/test/old/testdir/test_quickfix.vim index 791186efe8..33a33661b7 100644 --- a/test/old/testdir/test_quickfix.vim +++ b/test/old/testdir/test_quickfix.vim @@ -1020,52 +1020,50 @@ endfunc " More tests for 'errorformat' func Test_efm1() - if !has('unix') - " The 'errorformat' setting is different on non-Unix systems. - " This test works only on Unix-like systems. - return - endif + " The 'errorformat' setting is different on non-Unix systems. + " This test works only on Unix-like systems. + CheckUnix + + let l =<< trim [DATA] + "Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set. + "Xtestfile", line 6 col 19; this is an error + gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c + Xtestfile:9: parse error before `asd' + make: *** [src/vim/testdir/Makefile:100: test_quickfix] Error 1 + in file "Xtestfile" linenr 10: there is an error + + 2 returned + "Xtestfile", line 11 col 1; this is an error + "Xtestfile", line 12 col 2; this is another error + "Xtestfile", line 14:10; this is an error in column 10 + =Xtestfile=, line 15:10; this is another error, but in vcol 10 this time + "Xtestfile", linenr 16: yet another problem + Error in "Xtestfile" at line 17: + x should be a dot + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17 + ^ + Error in "Xtestfile" at line 18: + x should be a dot + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18 + .............^ + Error in "Xtestfile" at line 19: + x should be a dot + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19 + --------------^ + Error in "Xtestfile" at line 20: + x should be a dot + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20 + ^ + + Does anyone know what is the problem and how to correction it? + "Xtestfile", line 21 col 9: What is the title of the quickfix window? + "Xtestfile", line 22 col 9: What is the title of the quickfix window? + [DATA] + + call writefile(l, 'Xerrorfile1') + call writefile(l[:-2], 'Xerrorfile2') - let l =<< trim [DATA] - "Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set. - "Xtestfile", line 6 col 19; this is an error - gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c - Xtestfile:9: parse error before `asd' - make: *** [src/vim/testdir/Makefile:100: test_quickfix] Error 1 - in file "Xtestfile" linenr 10: there is an error - - 2 returned - "Xtestfile", line 11 col 1; this is an error - "Xtestfile", line 12 col 2; this is another error - "Xtestfile", line 14:10; this is an error in column 10 - =Xtestfile=, line 15:10; this is another error, but in vcol 10 this time - "Xtestfile", linenr 16: yet another problem - Error in "Xtestfile" at line 17: - x should be a dot - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17 - ^ - Error in "Xtestfile" at line 18: - x should be a dot - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18 - .............^ - Error in "Xtestfile" at line 19: - x should be a dot - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19 - --------------^ - Error in "Xtestfile" at line 20: - x should be a dot - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20 - ^ - - Does anyone know what is the problem and how to correction it? - "Xtestfile", line 21 col 9: What is the title of the quickfix window? - "Xtestfile", line 22 col 9: What is the title of the quickfix window? - [DATA] - - call writefile(l, 'Xerrorfile1') - call writefile(l[:-2], 'Xerrorfile2') - - let m =<< [DATA] + let m =<< [DATA] xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 4 @@ -1088,55 +1086,55 @@ func Test_efm1() xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22 [DATA] - call writefile(m, 'Xtestfile') + call writefile(m, 'Xtestfile') - let save_efm = &efm - set efm+==%f=\\,\ line\ %l%*\\D%v%*[^\ ]\ %m - set efm^=%AError\ in\ \"%f\"\ at\ line\ %l:,%Z%p^,%C%m + let save_efm = &efm + set efm+==%f=\\,\ line\ %l%*\\D%v%*[^\ ]\ %m + set efm^=%AError\ in\ \"%f\"\ at\ line\ %l:,%Z%p^,%C%m - exe 'cf Xerrorfile2' - clast - copen - call assert_equal(':cf Xerrorfile2', w:quickfix_title) - wincmd p + exe 'cf Xerrorfile2' + clast + copen + call assert_equal(':cf Xerrorfile2', w:quickfix_title) + wincmd p - exe 'cf Xerrorfile1' - call assert_equal([4, 12], [line('.'), col('.')]) - cn - call assert_equal([6, 19], [line('.'), col('.')]) - cn - call assert_equal([9, 2], [line('.'), col('.')]) - cn - call assert_equal([10, 2], [line('.'), col('.')]) - cn - call assert_equal([11, 1], [line('.'), col('.')]) - cn - call assert_equal([12, 2], [line('.'), col('.')]) - cn - call assert_equal([14, 10], [line('.'), col('.')]) - cn - call assert_equal([15, 3, 10], [line('.'), col('.'), virtcol('.')]) - cn - call assert_equal([16, 2], [line('.'), col('.')]) - cn - call assert_equal([17, 6], [line('.'), col('.')]) - cn - call assert_equal([18, 7], [line('.'), col('.')]) - cn - call assert_equal([19, 8], [line('.'), col('.')]) - cn - call assert_equal([20, 9], [line('.'), col('.')]) - clast - cprev - cprev - wincmd w - call assert_equal(':cf Xerrorfile1', w:quickfix_title) - wincmd p + exe 'cf Xerrorfile1' + call assert_equal([4, 12], [line('.'), col('.')]) + cn + call assert_equal([6, 19], [line('.'), col('.')]) + cn + call assert_equal([9, 2], [line('.'), col('.')]) + cn + call assert_equal([10, 2], [line('.'), col('.')]) + cn + call assert_equal([11, 1], [line('.'), col('.')]) + cn + call assert_equal([12, 2], [line('.'), col('.')]) + cn + call assert_equal([14, 10], [line('.'), col('.')]) + cn + call assert_equal([15, 3, 10], [line('.'), col('.'), virtcol('.')]) + cn + call assert_equal([16, 2], [line('.'), col('.')]) + cn + call assert_equal([17, 6], [line('.'), col('.')]) + cn + call assert_equal([18, 7], [line('.'), col('.')]) + cn + call assert_equal([19, 8], [line('.'), col('.')]) + cn + call assert_equal([20, 9], [line('.'), col('.')]) + clast + cprev + cprev + wincmd w + call assert_equal(':cf Xerrorfile1', w:quickfix_title) + wincmd p - let &efm = save_efm - call delete('Xerrorfile1') - call delete('Xerrorfile2') - call delete('Xtestfile') + let &efm = save_efm + call delete('Xerrorfile1') + call delete('Xerrorfile2') + call delete('Xtestfile') endfunc " Test for quickfix directory stack support @@ -1410,7 +1408,7 @@ func Test_efm2() failUnlessEqual raise self.failureException, \\ W:AssertionError: 34 != 33 - + -------------------------------------------------------------- Ran 27 tests in 0.063s [DATA] diff --git a/test/old/testdir/test_regexp_latin.vim b/test/old/testdir/test_regexp_latin.vim index 9857e1f886..99a82e8386 100644 --- a/test/old/testdir/test_regexp_latin.vim +++ b/test/old/testdir/test_regexp_latin.vim @@ -1164,7 +1164,7 @@ func Test_compare_column_matchstr() " matchstr(). enew call setline(1, ['one', 'two', 'three']) - :3 + :3 :/ee bwipe! set re=1 diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 76b4089bd1..02e1cc71e4 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -369,18 +369,18 @@ func Test_smoothscroll_wrap_long_line() call term_sendkeys(buf, ":set scrolloff=1\") call term_sendkeys(buf, "10|\") call VerifyScreenDump(buf, 'Test_smooth_long_6', {}) - + " 'scrolloff' set to 1, scrolling down, cursor moves screen line up call term_sendkeys(buf, "\") call term_sendkeys(buf, "gjgj") call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_smooth_long_7', {}) - + " 'scrolloff' set to 2, scrolling up, cursor moves screen line down call term_sendkeys(buf, ":set scrolloff=2\") call term_sendkeys(buf, "10|\") call VerifyScreenDump(buf, 'Test_smooth_long_8', {}) - + " 'scrolloff' set to 2, scrolling down, cursor moves screen line up call term_sendkeys(buf, "\") call term_sendkeys(buf, "gj") @@ -421,7 +421,7 @@ func Test_smoothscroll_wrap_long_line() call term_sendkeys(buf, "3Gzt") call term_sendkeys(buf, "\j") call VerifyScreenDump(buf, 'Test_smooth_long_16', {}) - + call StopVimInTerminal(buf) endfunc @@ -436,7 +436,7 @@ func Test_smoothscroll_one_long_line() call writefile(lines, 'XSmoothOneLong', 'D') let buf = RunVimInTerminal('-S XSmoothOneLong', #{rows: 6, cols: 40}) call VerifyScreenDump(buf, 'Test_smooth_one_long_1', {}) - + call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_smooth_one_long_2', {}) @@ -458,7 +458,7 @@ func Test_smoothscroll_long_line_showbreak() call writefile(lines, 'XSmoothLongShowbreak', 'D') let buf = RunVimInTerminal('-S XSmoothLongShowbreak', #{rows: 6, cols: 40}) call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_1', {}) - + call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_2', {}) @@ -648,7 +648,7 @@ func Test_smoothscroll_cursor_scrolloff() call NewWindow(10, 20) setl smoothscroll wrap setl scrolloff=3 - + " 120 chars are 6 screen lines call setline(1, "abcdefghijklmnopqrstABCDEFGHIJKLMNOPQRSTabcdefghijklmnopqrstABCDEFGHIJKLMNOPQRSTabcdefghijklmnopqrstABCDEFGHIJKLMNOPQRST") call setline(2, "below") diff --git a/test/old/testdir/test_signals.vim b/test/old/testdir/test_signals.vim index af4847e42c..4d4c7e405f 100644 --- a/test/old/testdir/test_signals.vim +++ b/test/old/testdir/test_signals.vim @@ -134,7 +134,7 @@ func Test_signal_TSTP() sleep 100m " We resume after the suspend. Sleep a bit for the signal to take effect, - " also when running under valgrind. + " also when running under valgrind. exe 'silent !kill -s CONT ' .. pid_vim call WaitForAssert({-> assert_true(filereadable('XautoOut2'))}) sleep 10m diff --git a/test/old/testdir/test_signs.vim b/test/old/testdir/test_signs.vim index 4bcf64fbba..4ac8831239 100644 --- a/test/old/testdir/test_signs.vim +++ b/test/old/testdir/test_signs.vim @@ -1808,10 +1808,10 @@ func Test_sign_cursor_position() let lines =<< trim END call setline(1, [repeat('x', 75), 'mmmm', 'yyyy']) call cursor(2,1) - sign define s1 texthl=Search text==> - sign define s2 linehl=Pmenu + sign define s1 texthl=Search text==> + sign define s2 linehl=Pmenu redraw - sign place 10 line=2 name=s1 + sign place 10 line=2 name=s1 END call writefile(lines, 'XtestSigncolumn', 'D') let buf = RunVimInTerminal('-S XtestSigncolumn', {'rows': 6}) diff --git a/test/old/testdir/test_statusline.vim b/test/old/testdir/test_statusline.vim index f8c326bb41..c8162ced07 100644 --- a/test/old/testdir/test_statusline.vim +++ b/test/old/testdir/test_statusline.vim @@ -417,7 +417,7 @@ func Test_statusline() " Test statusline works with 80+ items function! StatusLabel() redrawstatus - return '[label]' + return '[label]' endfunc let statusline = '%{StatusLabel()}' for i in range(150) diff --git a/test/old/testdir/test_substitute.vim b/test/old/testdir/test_substitute.vim index a8f2d99f50..f69a3c525b 100644 --- a/test/old/testdir/test_substitute.vim +++ b/test/old/testdir/test_substitute.vim @@ -743,7 +743,7 @@ func Test_sub_highlight_zero_match() endfunc func Test_nocatch_sub_failure_handling() - " normal error results in all replacements + " normal error results in all replacements func Foo() foobar endfunc diff --git a/test/old/testdir/test_tagfunc.vim b/test/old/testdir/test_tagfunc.vim index 44916f2fc9..812603a430 100644 --- a/test/old/testdir/test_tagfunc.vim +++ b/test/old/testdir/test_tagfunc.vim @@ -89,11 +89,11 @@ func Test_tagfunc() return v:null endfunc set tags= tfu=NullTagFunc - call assert_fails('tag nothing', 'E433') + call assert_fails('tag nothing', 'E433:') delf NullTagFunc bwipe! - set tags& tfu& cpt& + set tags& tfu& cpt& call delete('Xfile1') endfunc diff --git a/test/old/testdir/test_tagjump.vim b/test/old/testdir/test_tagjump.vim index 6fbb3b09b2..470c5c43b4 100644 --- a/test/old/testdir/test_tagjump.vim +++ b/test/old/testdir/test_tagjump.vim @@ -777,7 +777,7 @@ func Test_tag_guess() let code =<< trim [CODE] int FUNC1 (int x) { } - int + int func2 (int y) { } int * func3 () { } diff --git a/test/old/testdir/test_timers.vim b/test/old/testdir/test_timers.vim index 42114618fb..f412afc03d 100644 --- a/test/old/testdir/test_timers.vim +++ b/test/old/testdir/test_timers.vim @@ -348,8 +348,15 @@ endfunc " Test that the garbage collector isn't triggered if a timer callback invokes " vgetc(). func Test_nocatch_timer_garbage_collect() - " skipped: Nvim does not support test_garbagecollect_soon(), test_override() - return + " FIXME: why does this fail only on MacOS M1? + try + CheckNotMacM1 + throw 'Skipped: Nvim does not support test_garbagecollect_soon(), test_override()' + catch /Skipped/ + let g:skipped_reason = v:exception + return + endtry + " 'uptimetime. must be bigger than the timer timeout set ut=200 call test_garbagecollect_soon() diff --git a/test/old/testdir/test_true_false.vim b/test/old/testdir/test_true_false.vim index f3c7fff4a6..976a40e153 100644 --- a/test/old/testdir/test_true_false.vim +++ b/test/old/testdir/test_true_false.vim @@ -49,11 +49,11 @@ func Test_if() endfunc function Try_arg_true_false(expr, false_val, true_val) - for v in ['v:false', '0', '"0"', '"foo"', '" "'] + for v in ['v:false', '0', '"0"', '"foo"', '" "'] let r = eval(substitute(a:expr, '%v%', v, '')) call assert_equal(a:false_val, r, 'result for ' . v . ' is not ' . string(a:false_val) . ' but ' . string(r)) endfor - for v in ['v:true', '1', '"1"', '"1foo"'] + for v in ['v:true', '1', '"1"', '"1foo"'] let r = eval(substitute(a:expr, '%v%', v, '')) call assert_equal(a:true_val, r, 'result for ' . v . ' is not ' . string(a:true_val) . ' but ' . string(r)) endfor @@ -117,12 +117,11 @@ func Test_true_false_arg() endfunc function Try_arg_non_zero(expr, false_val, true_val) - CheckFeature float - for v in ['v:false', '0', '[1]', '{2:3}', '3.4'] + for v in ['v:false', '0', '[1]', '{2:3}', '3.4'] let r = eval(substitute(a:expr, '%v%', v, '')) call assert_equal(a:false_val, r, 'result for ' . v . ' is not ' . a:false_val . ' but ' . r) endfor - for v in ['v:true', '1', '" "', '"0"'] + for v in ['v:true', '1', '" "', '"0"'] let r = eval(substitute(a:expr, '%v%', v, '')) call assert_equal(a:true_val, r, 'result for ' . v . ' is not ' . a:true_val . ' but ' . r) endfor @@ -138,14 +137,14 @@ func Test_non_zero_arg() call Try_arg_non_zero("shellescape('foo%', %v%)", "'foo%'", "'foo\\%'") " visualmode() needs to be called twice to check - for v in [v:false, 0, [1], {2:3}, 3.4] + for v in [v:false, 0, [1], {2:3}, 3.4] normal vv let r = visualmode(v) call assert_equal('v', r, 'result for ' . string(v) . ' is not "v" but ' . r) let r = visualmode(v) call assert_equal('v', r, 'result for ' . string(v) . ' is not "v" but ' . r) endfor - for v in [v:true, 1, " ", "0"] + for v in [v:true, 1, " ", "0"] normal vv let r = visualmode(v) call assert_equal('v', r, 'result for ' . v . ' is not "v" but ' . r) diff --git a/test/old/testdir/test_utf8.vim b/test/old/testdir/test_utf8.vim index 51ac47f082..3248dc9d98 100644 --- a/test/old/testdir/test_utf8.vim +++ b/test/old/testdir/test_utf8.vim @@ -1,5 +1,5 @@ " Tests for Unicode manipulations - + source check.vim source view_util.vim source screendump.vim @@ -112,7 +112,7 @@ func Test_list2str_str2list_latin1() let save_encoding = &encoding " set encoding=latin1 - + let lres = str2list(s, 1) let sres = list2str(l, 1) call assert_equal([65, 66, 67], str2list("ABC")) diff --git a/test/old/testdir/test_virtualedit.vim b/test/old/testdir/test_virtualedit.vim index 8d9656e058..900dcd41cc 100644 --- a/test/old/testdir/test_virtualedit.vim +++ b/test/old/testdir/test_virtualedit.vim @@ -696,14 +696,14 @@ func Test_virtualedit_mouse() set virtualedit& endfunc -" this was replacing the NUL at the end of the line +" this was replacing the NUL at the end of the line func Test_virtualedit_replace_after_tab() new s/\v/ 0 set ve=all let @" = '' sil! norm vPvr0 - + call assert_equal("\t0", getline(1)) set ve& bwipe! diff --git a/test/old/testdir/test_visual.vim b/test/old/testdir/test_visual.vim index 5307c49012..e25327ddd4 100644 --- a/test/old/testdir/test_visual.vim +++ b/test/old/testdir/test_visual.vim @@ -1170,8 +1170,8 @@ endfunc func Test_visual_put_in_block_using_zp() new " paste using zP - call setline(1, ['/path;text', '/path;text', '/path;text', '', - \ '/subdir', + call setline(1, ['/path;text', '/path;text', '/path;text', '', + \ '/subdir', \ '/longsubdir', \ '/longlongsubdir']) exe "normal! 5G\2j$y" @@ -1179,8 +1179,8 @@ func Test_visual_put_in_block_using_zp() call assert_equal(['/path/subdir;text', '/path/longsubdir;text', '/path/longlongsubdir;text'], getline(1, 3)) %d " paste using zP - call setline(1, ['/path;text', '/path;text', '/path;text', '', - \ '/subdir', + call setline(1, ['/path;text', '/path;text', '/path;text', '', + \ '/subdir', \ '/longsubdir', \ '/longlongsubdir']) exe "normal! 5G\2j$y" @@ -1193,7 +1193,7 @@ func Test_visual_put_in_block_using_zy_and_zp() new " Test 1) Paste using zp - after the cursor without trailing spaces - call setline(1, ['/path;text', '/path;text', '/path;text', '', + call setline(1, ['/path;text', '/path;text', '/path;text', '', \ 'texttext /subdir columntext', \ 'texttext /longsubdir columntext', \ 'texttext /longlongsubdir columntext']) @@ -1203,7 +1203,7 @@ func Test_visual_put_in_block_using_zy_and_zp() " Test 2) Paste using zP - in front of the cursor without trailing spaces %d - call setline(1, ['/path;text', '/path;text', '/path;text', '', + call setline(1, ['/path;text', '/path;text', '/path;text', '', \ 'texttext /subdir columntext', \ 'texttext /longsubdir columntext', \ 'texttext /longlongsubdir columntext']) @@ -1213,7 +1213,7 @@ func Test_visual_put_in_block_using_zy_and_zp() " Test 3) Paste using p - with trailing spaces %d - call setline(1, ['/path;text', '/path;text', '/path;text', '', + call setline(1, ['/path;text', '/path;text', '/path;text', '', \ 'texttext /subdir columntext', \ 'texttext /longsubdir columntext', \ 'texttext /longlongsubdir columntext']) @@ -1223,7 +1223,7 @@ func Test_visual_put_in_block_using_zy_and_zp() " Test 4) Paste using P - with trailing spaces %d - call setline(1, ['/path;text', '/path;text', '/path;text', '', + call setline(1, ['/path;text', '/path;text', '/path;text', '', \ 'texttext /subdir columntext', \ 'texttext /longsubdir columntext', \ 'texttext /longlongsubdir columntext']) @@ -1233,7 +1233,7 @@ func Test_visual_put_in_block_using_zy_and_zp() " Test 5) Yank with spaces inside the block %d - call setline(1, ['/path;text', '/path;text', '/path;text', '', + call setline(1, ['/path;text', '/path;text', '/path;text', '', \ 'texttext /sub dir/ columntext', \ 'texttext /lon gsubdir/ columntext', \ 'texttext /lon glongsubdir/ columntext']) diff --git a/test/old/testdir/test_winbuf_close.vim b/test/old/testdir/test_winbuf_close.vim index 26b4ba8778..d2fa6f66bb 100644 --- a/test/old/testdir/test_winbuf_close.vim +++ b/test/old/testdir/test_winbuf_close.vim @@ -223,7 +223,7 @@ func Test_window_close_splitright_noequalalways() execute "normal \b" let h = winheight(0) let w = win_getid() - new + new q call assert_equal(h, winheight(0), "Window height does not match eight before opening and closing another window") call assert_equal(w, win_getid(), "Did not return to original window after opening and closing a window") -- cgit From bbe51ef016be57f73af3dafb12816a8167ff462a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 18 Jul 2024 06:45:26 +0800 Subject: vim-patch:9.1.0594: Unnecessary redraw when setting 'winfixbuf' (#29775) Problem: Unnecessary redraw when setting 'winfixbuf'. Solution: Remove P_RWIN flag. (zeertzjq) closes: vim/vim#15283 https://github.com/vim/vim/commit/ac4ce9e15b7ee0fccfa72aecf98b696d880e53c3 --- test/old/testdir/test_goto.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_goto.vim b/test/old/testdir/test_goto.vim index 0d5de7235e..8813bcbacd 100644 --- a/test/old/testdir/test_goto.vim +++ b/test/old/testdir/test_goto.vim @@ -321,14 +321,14 @@ func Test_set_options_keep_col() let pos = getcurpos() normal j set invhlsearch spell spelllang=en,cjk spelloptions=camel textwidth=80 - set cursorline cursorcolumn cursorlineopt=line colorcolumn=+1 + set cursorline cursorcolumn cursorlineopt=line colorcolumn=+1 winfixbuf set background=dark set background=light normal k call assert_equal(pos, getcurpos()) bwipe! set hlsearch& spell& spelllang& spelloptions& textwidth& - set cursorline& cursorcolumn& cursorlineopt& colorcolumn& + set cursorline& cursorcolumn& cursorlineopt& colorcolumn& winfixbuf& set background& endfunc -- cgit From 005f6e1076296e8e91848a019b5e4bef99c3e154 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 18 Jul 2024 06:46:52 +0800 Subject: vim-patch:partial:8.2.1432: various inconsistencies in test files Problem: Various inconsistencies in test files. Solution: Add modelines where they were missing. Use Check commands instead of silently skipping over tests. Adjust indents and comments. (Ken Takata, closes vim/vim#6695) https://github.com/vim/vim/commit/6d91bcb4d23b5c6a0be72c384beaf385e2d9d606 This only includes test_quickfix.vim changes. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_quickfix.vim | 490 ++++++++++++++++++------------------- 1 file changed, 244 insertions(+), 246 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_quickfix.vim b/test/old/testdir/test_quickfix.vim index 33a33661b7..6376a52cfa 100644 --- a/test/old/testdir/test_quickfix.vim +++ b/test/old/testdir/test_quickfix.vim @@ -2208,10 +2208,8 @@ func s:test_xgrep(cchar) endfunc func Test_grep() - if !has('unix') - " The grepprg may not be set on non-Unix systems - return - endif + " The grepprg may not be set on non-Unix systems + CheckUnix call s:test_xgrep('c') call s:test_xgrep('l') @@ -2349,254 +2347,254 @@ endfunc " Quickfix/Location list set/get properties tests func Xproperty_tests(cchar) - call s:setup_commands(a:cchar) + call s:setup_commands(a:cchar) - " Error cases - call assert_fails('call g:Xgetlist(99)', 'E715:') - call assert_fails('call g:Xsetlist(99)', 'E714:') - call assert_fails('call g:Xsetlist([], "a", [])', 'E715:') + " Error cases + call assert_fails('call g:Xgetlist(99)', 'E715:') + call assert_fails('call g:Xsetlist(99)', 'E714:') + call assert_fails('call g:Xsetlist([], "a", [])', 'E715:') - " Set and get the title - call g:Xsetlist([]) - Xopen - wincmd p - call g:Xsetlist([{'filename':'foo', 'lnum':27}]) - let s = g:Xsetlist([], 'a', {'title' : 'Sample'}) - call assert_equal(0, s) - let d = g:Xgetlist({"title":1}) - call assert_equal('Sample', d.title) - " Try setting title to a non-string value - call assert_equal(-1, g:Xsetlist([], 'a', {'title' : ['Test']})) - call assert_equal('Sample', g:Xgetlist({"title":1}).title) + " Set and get the title + call g:Xsetlist([]) + Xopen + wincmd p + call g:Xsetlist([{'filename':'foo', 'lnum':27}]) + let s = g:Xsetlist([], 'a', {'title' : 'Sample'}) + call assert_equal(0, s) + let d = g:Xgetlist({"title":1}) + call assert_equal('Sample', d.title) + " Try setting title to a non-string value + call assert_equal(-1, g:Xsetlist([], 'a', {'title' : ['Test']})) + call assert_equal('Sample', g:Xgetlist({"title":1}).title) - Xopen - call assert_equal('Sample', w:quickfix_title) - Xclose - - " Tests for action argument - silent! Xolder 999 - let qfnr = g:Xgetlist({'all':1}).nr - call g:Xsetlist([], 'r', {'title' : 'N1'}) - call assert_equal('N1', g:Xgetlist({'all':1}).title) - call g:Xsetlist([], ' ', {'title' : 'N2'}) - call assert_equal(qfnr + 1, g:Xgetlist({'all':1}).nr) - - let res = g:Xgetlist({'nr': 0}) - call assert_equal(qfnr + 1, res.nr) - call assert_equal(['nr'], keys(res)) - - call g:Xsetlist([], ' ', {'title' : 'N3'}) - call assert_equal('N2', g:Xgetlist({'nr':2, 'title':1}).title) - - " Changing the title of an earlier quickfix list - call g:Xsetlist([], 'r', {'title' : 'NewTitle', 'nr' : 2}) - call assert_equal('NewTitle', g:Xgetlist({'nr':2, 'title':1}).title) - - " Changing the title of an invalid quickfix list - call assert_equal(-1, g:Xsetlist([], ' ', - \ {'title' : 'SomeTitle', 'nr' : 99})) - call assert_equal(-1, g:Xsetlist([], ' ', - \ {'title' : 'SomeTitle', 'nr' : 'abc'})) - - if a:cchar == 'c' - copen - call assert_equal({'winid':win_getid()}, getqflist({'winid':1})) - cclose - endif + Xopen + call assert_equal('Sample', w:quickfix_title) + Xclose - " Invalid arguments - call assert_fails('call g:Xgetlist([])', 'E715') - call assert_fails('call g:Xsetlist([], "a", [])', 'E715') - let s = g:Xsetlist([], 'a', {'abc':1}) - call assert_equal(-1, s) + " Tests for action argument + silent! Xolder 999 + let qfnr = g:Xgetlist({'all':1}).nr + call g:Xsetlist([], 'r', {'title' : 'N1'}) + call assert_equal('N1', g:Xgetlist({'all':1}).title) + call g:Xsetlist([], ' ', {'title' : 'N2'}) + call assert_equal(qfnr + 1, g:Xgetlist({'all':1}).nr) - call assert_equal({}, g:Xgetlist({'abc':1})) - call assert_equal('', g:Xgetlist({'nr':99, 'title':1}).title) - call assert_equal('', g:Xgetlist({'nr':[], 'title':1}).title) + let res = g:Xgetlist({'nr': 0}) + call assert_equal(qfnr + 1, res.nr) + call assert_equal(['nr'], keys(res)) - if a:cchar == 'l' - call assert_equal({}, getloclist(99, {'title': 1})) - endif + call g:Xsetlist([], ' ', {'title' : 'N3'}) + call assert_equal('N2', g:Xgetlist({'nr':2, 'title':1}).title) - " Context related tests - let s = g:Xsetlist([], 'a', {'context':[1,2,3]}) - call assert_equal(0, s) - call test_garbagecollect_now() - let d = g:Xgetlist({'context':1}) - call assert_equal([1,2,3], d.context) - call g:Xsetlist([], 'a', {'context':{'color':'green'}}) - let d = g:Xgetlist({'context':1}) - call assert_equal({'color':'green'}, d.context) - call g:Xsetlist([], 'a', {'context':"Context info"}) - let d = g:Xgetlist({'context':1}) - call assert_equal("Context info", d.context) - call g:Xsetlist([], 'a', {'context':246}) - let d = g:Xgetlist({'context':1}) - call assert_equal(246, d.context) - " set other Vim data types as context - call g:Xsetlist([], 'a', {'context' : v:_null_blob}) - if has('channel') - call g:Xsetlist([], 'a', {'context' : test_null_channel()}) - endif - if has('job') - call g:Xsetlist([], 'a', {'context' : test_null_job()}) - endif - " Nvim doesn't have null functions - " call g:Xsetlist([], 'a', {'context' : test_null_function()}) - " Nvim doesn't have null partials - " call g:Xsetlist([], 'a', {'context' : test_null_partial()}) - call g:Xsetlist([], 'a', {'context' : ''}) - call test_garbagecollect_now() - if a:cchar == 'l' - " Test for copying context across two different location lists - new | only - let w1_id = win_getid() - let l = [1] - call setloclist(0, [], 'a', {'context':l}) - new - let w2_id = win_getid() - call add(l, 2) - call assert_equal([1, 2], getloclist(w1_id, {'context':1}).context) - call assert_equal([1, 2], getloclist(w2_id, {'context':1}).context) - unlet! l - call assert_equal([1, 2], getloclist(w2_id, {'context':1}).context) - only - call setloclist(0, [], 'f') - call assert_equal('', getloclist(0, {'context':1}).context) - endif + " Changing the title of an earlier quickfix list + call g:Xsetlist([], 'r', {'title' : 'NewTitle', 'nr' : 2}) + call assert_equal('NewTitle', g:Xgetlist({'nr':2, 'title':1}).title) - " Test for changing the context of previous quickfix lists - call g:Xsetlist([], 'f') - Xexpr "One" - Xexpr "Two" - Xexpr "Three" - call g:Xsetlist([], 'r', {'context' : [1], 'nr' : 1}) - call g:Xsetlist([], 'a', {'context' : [2], 'nr' : 2}) - " Also, check for setting the context using quickfix list number zero. - call g:Xsetlist([], 'r', {'context' : [3], 'nr' : 0}) - call test_garbagecollect_now() - let l = g:Xgetlist({'nr' : 1, 'context' : 1}) - call assert_equal([1], l.context) - let l = g:Xgetlist({'nr' : 2, 'context' : 1}) - call assert_equal([2], l.context) - let l = g:Xgetlist({'nr' : 3, 'context' : 1}) - call assert_equal([3], l.context) - - " Test for changing the context through reference and for garbage - " collection of quickfix context - let l = ["red"] - call g:Xsetlist([], ' ', {'context' : l}) - call add(l, "blue") - let x = g:Xgetlist({'context' : 1}) - call add(x.context, "green") - call assert_equal(["red", "blue", "green"], l) - call assert_equal(["red", "blue", "green"], x.context) - unlet l - call test_garbagecollect_now() - let m = g:Xgetlist({'context' : 1}) - call assert_equal(["red", "blue", "green"], m.context) - - " Test for setting/getting items - Xexpr "" - let qfprev = g:Xgetlist({'nr':0}) - let s = g:Xsetlist([], ' ', {'title':'Green', - \ 'items' : [{'filename':'F1', 'lnum':10}]}) - call assert_equal(0, s) - let qfcur = g:Xgetlist({'nr':0}) - call assert_true(qfcur.nr == qfprev.nr + 1) - let l = g:Xgetlist({'items':1}) - call assert_equal('F1', bufname(l.items[0].bufnr)) - call assert_equal(10, l.items[0].lnum) - call g:Xsetlist([], 'a', {'items' : [{'filename':'F2', 'lnum':20}, - \ {'filename':'F2', 'lnum':30}]}) - let l = g:Xgetlist({'items':1}) - call assert_equal('F2', bufname(l.items[2].bufnr)) - call assert_equal(30, l.items[2].lnum) - call g:Xsetlist([], 'r', {'items' : [{'filename':'F3', 'lnum':40}]}) - let l = g:Xgetlist({'items':1}) - call assert_equal('F3', bufname(l.items[0].bufnr)) - call assert_equal(40, l.items[0].lnum) - call g:Xsetlist([], 'r', {'items' : []}) - let l = g:Xgetlist({'items':1}) - call assert_equal(0, len(l.items)) - - call g:Xsetlist([], 'r', {'title' : 'TestTitle'}) - call g:Xsetlist([], 'r', {'items' : [{'filename' : 'F1', 'lnum' : 10, 'text' : 'L10'}]}) - call g:Xsetlist([], 'r', {'items' : [{'filename' : 'F1', 'lnum' : 10, 'text' : 'L10'}]}) - call assert_equal('TestTitle', g:Xgetlist({'title' : 1}).title) - - " Test for getting id of window associated with a location list window - if a:cchar == 'l' - only - call assert_equal(0, g:Xgetlist({'all' : 1}).filewinid) - let wid = win_getid() - Xopen - call assert_equal(wid, g:Xgetlist({'filewinid' : 1}).filewinid) - wincmd w - call assert_equal(0, g:Xgetlist({'filewinid' : 1}).filewinid) - only - endif + " Changing the title of an invalid quickfix list + call assert_equal(-1, g:Xsetlist([], ' ', + \ {'title' : 'SomeTitle', 'nr' : 99})) + call assert_equal(-1, g:Xsetlist([], ' ', + \ {'title' : 'SomeTitle', 'nr' : 'abc'})) - " The following used to crash Vim with address sanitizer - call g:Xsetlist([], 'f') - call g:Xsetlist([], 'a', {'items' : [{'filename':'F1', 'lnum':10}]}) - call assert_equal(10, g:Xgetlist({'items':1}).items[0].lnum) + if a:cchar == 'c' + copen + call assert_equal({'winid':win_getid()}, getqflist({'winid':1})) + cclose + endif - " Try setting the items using a string - call assert_equal(-1, g:Xsetlist([], ' ', {'items' : 'Test'})) + " Invalid arguments + call assert_fails('call g:Xgetlist([])', 'E715') + call assert_fails('call g:Xsetlist([], "a", [])', 'E715') + let s = g:Xsetlist([], 'a', {'abc':1}) + call assert_equal(-1, s) - " Save and restore the quickfix stack - call g:Xsetlist([], 'f') - call assert_equal(0, g:Xgetlist({'nr':'$'}).nr) - Xexpr "File1:10:Line1" - Xexpr "File2:20:Line2" - Xexpr "File3:30:Line3" - let last_qf = g:Xgetlist({'nr':'$'}).nr - call assert_equal(3, last_qf) - let qstack = [] - for i in range(1, last_qf) - let qstack = add(qstack, g:Xgetlist({'nr':i, 'all':1})) - endfor - call g:Xsetlist([], 'f') - for i in range(len(qstack)) - call g:Xsetlist([], ' ', qstack[i]) - endfor - call assert_equal(3, g:Xgetlist({'nr':'$'}).nr) - call assert_equal(10, g:Xgetlist({'nr':1, 'items':1}).items[0].lnum) - call assert_equal(20, g:Xgetlist({'nr':2, 'items':1}).items[0].lnum) - call assert_equal(30, g:Xgetlist({'nr':3, 'items':1}).items[0].lnum) - call g:Xsetlist([], 'f') + call assert_equal({}, g:Xgetlist({'abc':1})) + call assert_equal('', g:Xgetlist({'nr':99, 'title':1}).title) + call assert_equal('', g:Xgetlist({'nr':[], 'title':1}).title) - " Swap two quickfix lists - Xexpr "File1:10:Line10" - Xexpr "File2:20:Line20" - Xexpr "File3:30:Line30" - call g:Xsetlist([], 'r', {'nr':1,'title':'Colors','context':['Colors']}) - call g:Xsetlist([], 'r', {'nr':2,'title':'Fruits','context':['Fruits']}) - let l1=g:Xgetlist({'nr':1,'all':1}) - let l2=g:Xgetlist({'nr':2,'all':1}) - let save_id = l1.id - let l1.id=l2.id - let l2.id=save_id - call g:Xsetlist([], 'r', l1) - call g:Xsetlist([], 'r', l2) - let newl1=g:Xgetlist({'nr':1,'all':1}) - let newl2=g:Xgetlist({'nr':2,'all':1}) - call assert_equal('Fruits', newl1.title) - call assert_equal(['Fruits'], newl1.context) - call assert_equal('Line20', newl1.items[0].text) - call assert_equal('Colors', newl2.title) - call assert_equal(['Colors'], newl2.context) - call assert_equal('Line10', newl2.items[0].text) - call g:Xsetlist([], 'f') + if a:cchar == 'l' + call assert_equal({}, getloclist(99, {'title': 1})) + endif + + " Context related tests + let s = g:Xsetlist([], 'a', {'context':[1,2,3]}) + call assert_equal(0, s) + call test_garbagecollect_now() + let d = g:Xgetlist({'context':1}) + call assert_equal([1,2,3], d.context) + call g:Xsetlist([], 'a', {'context':{'color':'green'}}) + let d = g:Xgetlist({'context':1}) + call assert_equal({'color':'green'}, d.context) + call g:Xsetlist([], 'a', {'context':"Context info"}) + let d = g:Xgetlist({'context':1}) + call assert_equal("Context info", d.context) + call g:Xsetlist([], 'a', {'context':246}) + let d = g:Xgetlist({'context':1}) + call assert_equal(246, d.context) + " set other Vim data types as context + call g:Xsetlist([], 'a', {'context' : v:_null_blob}) + if has('channel') + call g:Xsetlist([], 'a', {'context' : test_null_channel()}) + endif + if has('job') + call g:Xsetlist([], 'a', {'context' : test_null_job()}) + endif + " Nvim doesn't have null functions + " call g:Xsetlist([], 'a', {'context' : test_null_function()}) + " Nvim doesn't have null partials + " call g:Xsetlist([], 'a', {'context' : test_null_partial()}) + call g:Xsetlist([], 'a', {'context' : ''}) + call test_garbagecollect_now() + if a:cchar == 'l' + " Test for copying context across two different location lists + new | only + let w1_id = win_getid() + let l = [1] + call setloclist(0, [], 'a', {'context':l}) + new + let w2_id = win_getid() + call add(l, 2) + call assert_equal([1, 2], getloclist(w1_id, {'context':1}).context) + call assert_equal([1, 2], getloclist(w2_id, {'context':1}).context) + unlet! l + call assert_equal([1, 2], getloclist(w2_id, {'context':1}).context) + only + call setloclist(0, [], 'f') + call assert_equal('', getloclist(0, {'context':1}).context) + endif + + " Test for changing the context of previous quickfix lists + call g:Xsetlist([], 'f') + Xexpr "One" + Xexpr "Two" + Xexpr "Three" + call g:Xsetlist([], 'r', {'context' : [1], 'nr' : 1}) + call g:Xsetlist([], 'a', {'context' : [2], 'nr' : 2}) + " Also, check for setting the context using quickfix list number zero. + call g:Xsetlist([], 'r', {'context' : [3], 'nr' : 0}) + call test_garbagecollect_now() + let l = g:Xgetlist({'nr' : 1, 'context' : 1}) + call assert_equal([1], l.context) + let l = g:Xgetlist({'nr' : 2, 'context' : 1}) + call assert_equal([2], l.context) + let l = g:Xgetlist({'nr' : 3, 'context' : 1}) + call assert_equal([3], l.context) + + " Test for changing the context through reference and for garbage + " collection of quickfix context + let l = ["red"] + call g:Xsetlist([], ' ', {'context' : l}) + call add(l, "blue") + let x = g:Xgetlist({'context' : 1}) + call add(x.context, "green") + call assert_equal(["red", "blue", "green"], l) + call assert_equal(["red", "blue", "green"], x.context) + unlet l + call test_garbagecollect_now() + let m = g:Xgetlist({'context' : 1}) + call assert_equal(["red", "blue", "green"], m.context) + + " Test for setting/getting items + Xexpr "" + let qfprev = g:Xgetlist({'nr':0}) + let s = g:Xsetlist([], ' ', {'title':'Green', + \ 'items' : [{'filename':'F1', 'lnum':10}]}) + call assert_equal(0, s) + let qfcur = g:Xgetlist({'nr':0}) + call assert_true(qfcur.nr == qfprev.nr + 1) + let l = g:Xgetlist({'items':1}) + call assert_equal('F1', bufname(l.items[0].bufnr)) + call assert_equal(10, l.items[0].lnum) + call g:Xsetlist([], 'a', {'items' : [{'filename':'F2', 'lnum':20}, + \ {'filename':'F2', 'lnum':30}]}) + let l = g:Xgetlist({'items':1}) + call assert_equal('F2', bufname(l.items[2].bufnr)) + call assert_equal(30, l.items[2].lnum) + call g:Xsetlist([], 'r', {'items' : [{'filename':'F3', 'lnum':40}]}) + let l = g:Xgetlist({'items':1}) + call assert_equal('F3', bufname(l.items[0].bufnr)) + call assert_equal(40, l.items[0].lnum) + call g:Xsetlist([], 'r', {'items' : []}) + let l = g:Xgetlist({'items':1}) + call assert_equal(0, len(l.items)) + + call g:Xsetlist([], 'r', {'title' : 'TestTitle'}) + call g:Xsetlist([], 'r', {'items' : [{'filename' : 'F1', 'lnum' : 10, 'text' : 'L10'}]}) + call g:Xsetlist([], 'r', {'items' : [{'filename' : 'F1', 'lnum' : 10, 'text' : 'L10'}]}) + call assert_equal('TestTitle', g:Xgetlist({'title' : 1}).title) + + " Test for getting id of window associated with a location list window + if a:cchar == 'l' + only + call assert_equal(0, g:Xgetlist({'all' : 1}).filewinid) + let wid = win_getid() + Xopen + call assert_equal(wid, g:Xgetlist({'filewinid' : 1}).filewinid) + wincmd w + call assert_equal(0, g:Xgetlist({'filewinid' : 1}).filewinid) + only + endif + + " The following used to crash Vim with address sanitizer + call g:Xsetlist([], 'f') + call g:Xsetlist([], 'a', {'items' : [{'filename':'F1', 'lnum':10}]}) + call assert_equal(10, g:Xgetlist({'items':1}).items[0].lnum) + + " Try setting the items using a string + call assert_equal(-1, g:Xsetlist([], ' ', {'items' : 'Test'})) + + " Save and restore the quickfix stack + call g:Xsetlist([], 'f') + call assert_equal(0, g:Xgetlist({'nr':'$'}).nr) + Xexpr "File1:10:Line1" + Xexpr "File2:20:Line2" + Xexpr "File3:30:Line3" + let last_qf = g:Xgetlist({'nr':'$'}).nr + call assert_equal(3, last_qf) + let qstack = [] + for i in range(1, last_qf) + let qstack = add(qstack, g:Xgetlist({'nr':i, 'all':1})) + endfor + call g:Xsetlist([], 'f') + for i in range(len(qstack)) + call g:Xsetlist([], ' ', qstack[i]) + endfor + call assert_equal(3, g:Xgetlist({'nr':'$'}).nr) + call assert_equal(10, g:Xgetlist({'nr':1, 'items':1}).items[0].lnum) + call assert_equal(20, g:Xgetlist({'nr':2, 'items':1}).items[0].lnum) + call assert_equal(30, g:Xgetlist({'nr':3, 'items':1}).items[0].lnum) + call g:Xsetlist([], 'f') + + " Swap two quickfix lists + Xexpr "File1:10:Line10" + Xexpr "File2:20:Line20" + Xexpr "File3:30:Line30" + call g:Xsetlist([], 'r', {'nr':1,'title':'Colors','context':['Colors']}) + call g:Xsetlist([], 'r', {'nr':2,'title':'Fruits','context':['Fruits']}) + let l1=g:Xgetlist({'nr':1,'all':1}) + let l2=g:Xgetlist({'nr':2,'all':1}) + let save_id = l1.id + let l1.id=l2.id + let l2.id=save_id + call g:Xsetlist([], 'r', l1) + call g:Xsetlist([], 'r', l2) + let newl1=g:Xgetlist({'nr':1,'all':1}) + let newl2=g:Xgetlist({'nr':2,'all':1}) + call assert_equal('Fruits', newl1.title) + call assert_equal(['Fruits'], newl1.context) + call assert_equal('Line20', newl1.items[0].text) + call assert_equal('Colors', newl2.title) + call assert_equal(['Colors'], newl2.context) + call assert_equal('Line10', newl2.items[0].text) + call g:Xsetlist([], 'f') - " Cannot specify both a non-empty list argument and a dict argument - call assert_fails("call g:Xsetlist([{}], ' ', {})", 'E475:') + " Cannot specify both a non-empty list argument and a dict argument + call assert_fails("call g:Xsetlist([{}], ' ', {})", 'E475:') endfunc func Test_qf_property() - call Xproperty_tests('c') - call Xproperty_tests('l') + call Xproperty_tests('c') + call Xproperty_tests('l') endfunc " Test for setting the current index in the location/quickfix list @@ -3130,7 +3128,7 @@ func Test_vimgrep_existing_swapfile() call assert_match('.Xapple.swo', swapname('')) call delete('Xapple') - call delete('Xapple.swp') + call delete('.Xapple.swp') augroup grep au! SwapExists augroup END @@ -3583,15 +3581,15 @@ endfunc " Open multiple help windows using ":lhelpgrep " This test used to crash Vim func Test_Multi_LL_Help() - new | only - lhelpgrep window - lopen - e# - lhelpgrep buffer - call assert_equal(3, winnr('$')) - call assert_true(len(getloclist(1)) != 0) - call assert_true(len(getloclist(2)) != 0) - new | only + new | only + lhelpgrep window + lopen + e# + lhelpgrep buffer + call assert_equal(3, winnr('$')) + call assert_true(len(getloclist(1)) != 0) + call assert_true(len(getloclist(2)) != 0) + new | only endfunc " Tests for adding new quickfix lists using setqflist() -- cgit From 286f7ef8a8cfe2f712f3593a237b2104f6ec6851 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 18 Jul 2024 06:47:37 +0800 Subject: vim-patch:partial:8.2.2571: test may leave file behind Problem: Test may leave file behind. Solution: Delete the temporary file. Don't profile in the running Vim instance. https://github.com/vim/vim/commit/8c801b374b7d32419cd877353495b801c5e1382a This only includes test_quickfix.vim changes. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_quickfix.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_quickfix.vim b/test/old/testdir/test_quickfix.vim index 6376a52cfa..bba68bcdc7 100644 --- a/test/old/testdir/test_quickfix.vim +++ b/test/old/testdir/test_quickfix.vim @@ -5920,6 +5920,16 @@ func Test_qfbuf_update() call Xqfbuf_update('l') endfunc +func Test_vimgrep_noswapfile() + set noswapfile + call writefile(['one', 'two', 'three'], 'Xgreppie') + vimgrep two Xgreppie + call assert_equal('two', getline('.')) + + call delete('Xgreppie') + set swapfile +endfunc + " Test for the :vimgrep 'f' flag (fuzzy match) func Xvimgrep_fuzzy_match(cchar) call s:setup_commands(a:cchar) -- cgit From 185b22720de9156393ddc22c2c59dc3eb46b8d97 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 18 Jul 2024 07:47:20 +0800 Subject: vim-patch:9.0.0003: functions are global while they could be local (#29777) Problem: Functions are global while they could be local. Solution: Add "static". Add a few tests. (Yegappan Lakshmanan, closes vim/vim#10612) https://github.com/vim/vim/commit/ee47eaceaa148e07b566ff420f9a3c2edde2fa34 Omit script_name_after_autoload(), untrans_function_name(): Vim9 script only. Co-authored-by: Yegappan Lakshmanan --- test/old/testdir/test_fold.vim | 2 ++ test/old/testdir/test_quickfix.vim | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_fold.vim b/test/old/testdir/test_fold.vim index 829cfc674d..aca497f28d 100644 --- a/test/old/testdir/test_fold.vim +++ b/test/old/testdir/test_fold.vim @@ -1486,6 +1486,8 @@ func Test_fold_split() call assert_equal([0, 1, 1, 2, 2], range(1, 5)->map('foldlevel(v:val)')) call append(2, 'line 2.5') call assert_equal([0, 1, 0, 1, 2, 2], range(1, 6)->map('foldlevel(v:val)')) + 3d + call assert_equal([0, 1, 1, 2, 2], range(1, 5)->map('foldlevel(v:val)')) bw! endfunc diff --git a/test/old/testdir/test_quickfix.vim b/test/old/testdir/test_quickfix.vim index bba68bcdc7..7eb2945198 100644 --- a/test/old/testdir/test_quickfix.vim +++ b/test/old/testdir/test_quickfix.vim @@ -3208,8 +3208,11 @@ func Test_bufoverflow() cgetexpr ['Compiler: ' . repeat('a', 1015), 'File1:10:Hello World'] set efm=%DEntering\ directory\ %f,%f:%l:%m - cgetexpr ['Entering directory ' . repeat('a', 1006), - \ 'File1:10:Hello World'] + let lines =<< trim eval END + Entering directory $"{repeat('a', 1006)}" + File1:10:Hello World + END + cgetexpr lines set efm&vim endfunc -- cgit From c69ea53c9d73a29f504043cc38d4e9fac076f93b Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 18 Jul 2024 09:13:16 +0200 Subject: vim-patch:9.1.0596: filetype: devscripts config files are not recognized (#29773) Problem: filetype: Debian devscripts config files are not recognized Solution: detect devscripts.conf and .devscripts files as sh filetype (sourced by /bin/sh) closes: vim/vim#15227 https://github.com/vim/vim/commit/76c19028ffc8b00816df7bc48985c92f7bacbcfb Co-authored-by: Wu, Zhenyu --- test/old/testdir/test_filetype.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index adc5ee076b..3dff957cd5 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -652,7 +652,8 @@ func s:GetFilenameChecks() abort \ 'sh': ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', '.bash-aliases', '.bash_history', '.bash-history', \ '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD', 'APKBUILD', 'file.bash', '/usr/share/doc/bash-completion/filter.sh', \ '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', 'file.bats', '.ash_history', 'any/etc/neofetch/config.conf', '.xprofile', - \ 'user-dirs.defaults', 'user-dirs.dirs', 'makepkg.conf', '.makepkg.conf', 'file.mdd', 'file.cygport', '.env', '.envrc'], + \ 'user-dirs.defaults', 'user-dirs.dirs', 'makepkg.conf', '.makepkg.conf', 'file.mdd', 'file.cygport', '.env', '.envrc', 'devscripts.conf', + \ '.devscripts'], \ 'sieve': ['file.siv', 'file.sieve'], \ 'sil': ['file.sil'], \ 'simula': ['file.sim'], -- cgit From 0b710c8e55930a082e030f980f84bd1e71a29592 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 19 Jul 2024 11:48:13 +0800 Subject: vim-patch:9.1.0599: Termdebug: still get E1023 when specifying arguments (#29794) Problem: Termdebug: still get E1023 when specifying arguments and using a prompt buffer. Solution: Use empty() instead of len(). Add a test. Fix wrong order of arguments to assert_equal() in Test_termdebug_basic(). (zeertzjq) closes: vim/vim#15288 https://github.com/vim/vim/commit/aef6179bcf04918002103528651996c754c03840 --- test/old/testdir/test_termdebug.vim | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_termdebug.vim b/test/old/testdir/test_termdebug.vim index bb107161eb..eb88ea6f5f 100644 --- a/test/old/testdir/test_termdebug.vim +++ b/test/old/testdir/test_termdebug.vim @@ -124,13 +124,13 @@ func Test_termdebug_basic() " 60 is approx spaceBuffer * 3 if winwidth(0) <= 78 + 60 Var - call assert_equal(winnr(), winnr('$')) - call assert_equal(winlayout(), ['col', [['leaf', 1002], ['leaf', 1001], ['leaf', 1000], ['leaf', 1003 + cn]]]) + call assert_equal(winnr('$'), winnr()) + call assert_equal(['col', [['leaf', 1002], ['leaf', 1001], ['leaf', 1000], ['leaf', 1003 + cn]]], winlayout()) let cn += 1 bw! Asm - call assert_equal(winnr(), winnr('$')) - call assert_equal(winlayout(), ['col', [['leaf', 1002], ['leaf', 1001], ['leaf', 1000], ['leaf', 1003 + cn]]]) + call assert_equal(winnr('$'), winnr()) + call assert_equal(['col', [['leaf', 1002], ['leaf', 1001], ['leaf', 1000], ['leaf', 1003 + cn]]], winlayout()) let cn += 1 bw! endif @@ -139,16 +139,16 @@ func Test_termdebug_basic() let winw = winwidth(0) Var if winwidth(0) < winw - call assert_equal(winnr(), winnr('$') - 1) - call assert_equal(winlayout(), ['col', [['leaf', 1002], ['leaf', 1001], ['row', [['leaf', 1003 + cn], ['leaf', 1000]]]]]) + call assert_equal(winnr('$') - 1, winnr()) + call assert_equal(['col', [['leaf', 1002], ['leaf', 1001], ['row', [['leaf', 1003 + cn], ['leaf', 1000]]]]], winlayout()) let cn += 1 bw! endif let winw = winwidth(0) Asm if winwidth(0) < winw - call assert_equal(winnr(), winnr('$') - 1) - call assert_equal(winlayout(), ['col', [['leaf', 1002], ['leaf', 1001], ['row', [['leaf', 1003 + cn], ['leaf', 1000]]]]]) + call assert_equal(winnr('$') - 1, winnr()) + call assert_equal(['col', [['leaf', 1002], ['leaf', 1001], ['row', [['leaf', 1003 + cn], ['leaf', 1000]]]]], winlayout()) let cn += 1 bw! endif @@ -161,6 +161,18 @@ func Test_termdebug_basic() call WaitForAssert({-> assert_equal(1, winnr('$'))}) call assert_equal([], sign_getplaced('', #{group: 'TermDebug'})[0].signs) + for use_prompt in [0, 1] + let g:termdebug_config = {} + let g:termdebug_config['use_prompt'] = use_prompt + TermdebugCommand ./XTD_basic arg args + call WaitForAssert({-> assert_equal(3, winnr('$'))}) + wincmd t + quit! + redraw! + call WaitForAssert({-> assert_equal(1, winnr('$'))}) + unlet g:termdebug_config + endfor + call s:cleanup_files(bin_name) %bw! endfunc -- cgit From 35b35cb93cb54d2a9b7f881b930ba42186e57d23 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 19 Jul 2024 11:54:42 +0800 Subject: vim-patch:9.1.0601: Wrong cursor position with 'breakindent' when wide char doesn't fit (#29793) Problem: Wrong cursor position with 'breakindent' when a double-width character doesn't fit in a screen line (mikoto2000) Solution: Include the width of the 'breakindent' properly. (zeertzjq) fixes: vim/vim#15289 closes: vim/vim#15290 https://github.com/vim/vim/commit/b5d6b5caac752fe15856e37fd3abc5459292d4b8 --- test/old/testdir/test_breakindent.vim | 11 +++++++++++ test/old/testdir/test_listlbr_utf8.vim | 6 ++++++ 2 files changed, 17 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_breakindent.vim b/test/old/testdir/test_breakindent.vim index 636ec6f285..f09ab8684f 100644 --- a/test/old/testdir/test_breakindent.vim +++ b/test/old/testdir/test_breakindent.vim @@ -1205,4 +1205,15 @@ func Test_breakindent_min_with_signcol() call s:close_windows() endfunc +func Test_breakindent_with_double_width_wrap() + 50vnew + setlocal tabstop=8 breakindent nolist + call setline(1, "\t" .. repeat('a', winwidth(0) - 9) .. '口口口') + normal! $g0 + call assert_equal(2, winline()) + call assert_equal(9, wincol()) + + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_listlbr_utf8.vim b/test/old/testdir/test_listlbr_utf8.vim index 313ff30cc4..693f2015fc 100644 --- a/test/old/testdir/test_listlbr_utf8.vim +++ b/test/old/testdir/test_listlbr_utf8.vim @@ -280,6 +280,9 @@ func Test_chinese_char_on_wrap_column() call s:compare_lines(expect, lines) call assert_equal(len(expect), winline()) call assert_equal(strwidth(trim(expect[-1], ' ', 2)), wincol()) + norm! g0 + call assert_equal(len(expect), winline()) + call assert_equal(1, wincol()) call s:close_windows() endfunc @@ -315,6 +318,9 @@ func Test_chinese_char_on_wrap_column_sbr() call s:compare_lines(expect, lines) call assert_equal(len(expect), winline()) call assert_equal(strwidth(trim(expect[-1], ' ', 2)), wincol()) + norm! g0 + call assert_equal(len(expect), winline()) + call assert_equal(4, wincol()) call s:close_windows() endfunc -- cgit From 44f871a3cb7b0d40ebef0210d0e7cccf8ecdcda9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 19 Jul 2024 12:55:55 +0800 Subject: vim-patch:9.1.0558: filetype: prolog detection can be improved Problem: filetype: prolog detection can be improved Solution: Improved the Prolog file detection regex and added tests for all cases. (igna_martinoli) fixes: vim/vim#10835 closes: vim/vim#15206 https://github.com/vim/vim/commit/50dc83cf9215aa787da54abbb0bd2ab4fb89e720 Only include the tests, as code changes are superseded by later patches. Co-authored-by: igna_martinoli --- test/old/testdir/test_filetype.vim | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 3dff957cd5..aa522c3098 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -2576,4 +2576,31 @@ func Test_uci_file() filetype off endfunc +func Test_pro_file() + filetype on + + "Prolog + call writefile([':-module(test/1,'], 'Xfile.pro', 'D') + split Xfile.pro + call assert_equal('prolog', &filetype) + bwipe! + + call writefile(['% comment'], 'Xfile.pro', 'D') + split Xfile.pro + call assert_equal('prolog', &filetype) + bwipe! + + call writefile(['/* multiline comment'], 'Xfile.pro', 'D') + split Xfile.pro + call assert_equal('prolog', &filetype) + bwipe! + + call writefile(['rule(test, 1.7).'], 'Xfile.pro', 'D') + split Xfile.pro + call assert_equal('prolog', &filetype) + bwipe! + + filetype off +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From f67a7365afacfad3f05e7aaca0bb2538a6e9f125 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 19 Jul 2024 12:57:56 +0800 Subject: vim-patch:9.1.0602: filetype: Prolog detection can be improved Problem: filetype: Prolog detection can be improved Solution: update the prolog detection regex (igna_martinoli) related: vim/vim#10835 related: vim/vim#15206 closes: vim/vim#15253 https://github.com/vim/vim/commit/37853b7de31ef34153fe76aa2b740d517ed0e5d4 N/A patch: vim-patch:7347642: runtime(filetype): Fix Prolog file detection regex Problem: filetype: .pro file detection for Prolog is broken Solution: fixed the regex to only match on the tested cases (igna_martinoli) fixes: vim/vim#10835 closes: vim/vim#15206 https://github.com/vim/vim/commit/7347642633eb2de23a78c51a4388c9080440eec4 Co-authored-by: igna_martinoli Co-authored-by: clason --- test/old/testdir/test_filetype.vim | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index aa522c3098..ba7836cd4f 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -2600,6 +2600,44 @@ func Test_pro_file() call assert_equal('prolog', &filetype) bwipe! + " IDL + call writefile(['x = findgen(100)/10'], 'Xfile.pro', 'D') + split Xfile.pro + call assert_equal('idlang', &filetype) + + filetype off +endfunc + + +func Test_pl_file() + filetype on + + "Prolog + call writefile([':-module(test/1,'], 'Xfile.pl', 'D') + split Xfile.pl + call assert_equal('prolog', &filetype) + bwipe! + + call writefile(['% comment'], 'Xfile.pl', 'D') + split Xfile.pl + call assert_equal('prolog', &filetype) + bwipe! + + call writefile(['/* multiline comment'], 'Xfile.pl', 'D') + split Xfile.pl + call assert_equal('prolog', &filetype) + bwipe! + + call writefile(['rule(test, 1.7).'], 'Xfile.pl', 'D') + split Xfile.pl + call assert_equal('prolog', &filetype) + bwipe! + + " Perl + call writefile(['%data = (1, 2, 3);'], 'Xfile.pl', 'D') + split Xfile.pl + call assert_equal('perl', &filetype) + filetype off endfunc -- cgit From 2a24d0a4357d24d6edbd454ab2465abf460467db Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 19 Jul 2024 16:56:41 +0200 Subject: vim-patch:9.1.0603: filetype: use correct extension for Dracula Problem: pattern detection for Dracula language uses "*lvs" and "*lpe". as there is no dot, those are not treated as extensions which they should (judging by 'runtime/syntax/dracula.vim' and common sense). Solution: use "*.lvs" and "*.lpe" patterns (Evgeni Chasnovski) closes: vim/vim#15303 https://github.com/vim/vim/commit/5fb801a74faaf3ef1262c2988b8801500ca71646 Co-authored-by: Evgeni Chasnovski --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index ba7836cd4f..c004c4bae3 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -226,7 +226,7 @@ func s:GetFilenameChecks() abort \ 'psprint.conf', 'sofficerc', 'any/.config/lxqt/globalkeyshortcuts.conf', 'any/.config/screengrab/screengrab.conf', \ 'any/.local/share/flatpak/repo/config', '.notmuch-config'], \ 'dot': ['file.dot', 'file.gv'], - \ 'dracula': ['file.drac', 'file.drc', 'filelvs', 'filelpe', 'drac.file', 'lpe', 'lvs', 'some-lpe', 'some-lvs'], + \ 'dracula': ['file.drac', 'file.drc', 'file.lvs', 'file.lpe', 'drac.file'], \ 'dtd': ['file.dtd'], \ 'dtrace': ['/usr/lib/dtrace/io.d'], \ 'dts': ['file.dts', 'file.dtsi', 'file.dtso', 'file.its', 'file.keymap'], -- cgit From 79d492a4218ee6b4da5becbebb712a0f1f65d0f5 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Mon, 22 Jul 2024 17:28:05 -0500 Subject: vim-patch:9.1.0610: filetype: OpenGL Shading Language files are not detected (#29831) Problem: filetype: OpenGL Shading Language files are not detected Solution: detect various file extensions as GLSL filetype, include indent and syntax script, do no longer recognize '*.comp' as Mason filetype (Gregory Anders) closes: vim/vim#15317 https://github.com/vim/vim/commit/e4b991ed36f96dd01c6d75e46a04fd1a99180e58 --- test/old/testdir/test_filetype.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index c004c4bae3..1d507af17c 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -296,7 +296,7 @@ func s:GetFilenameChecks() abort \ 'gitsendemail': ['.gitsendemail.msg.xxxxxx'], \ 'gkrellmrc': ['gkrellmrc', 'gkrellmrc_x'], \ 'gleam': ['file.gleam'], - \ 'glsl': ['file.glsl'], + \ 'glsl': ['file.glsl', 'file.vert', 'file.tesc', 'file.tese', 'file.geom', 'file.frag', 'file.comp', 'file.rgen', 'file.rmiss', 'file.rchit', 'file.rahit', 'file.rint', 'file.rcall'], \ 'gn': ['file.gn', 'file.gni'], \ 'gnash': ['gnashrc', '.gnashrc', 'gnashpluginrc', '.gnashpluginrc'], \ 'gnuplot': ['file.gpi', '.gnuplot', 'file.gnuplot', '.gnuplot_history'], @@ -433,7 +433,7 @@ func s:GetFilenameChecks() abort \ 'map': ['file.map'], \ 'maple': ['file.mv', 'file.mpl', 'file.mws'], \ 'markdown': ['file.markdown', 'file.mdown', 'file.mkd', 'file.mkdn', 'file.mdwn', 'file.md'], - \ 'mason': ['file.mason', 'file.mhtml', 'file.comp'], + \ 'mason': ['file.mason', 'file.mhtml'], \ 'master': ['file.mas', 'file.master'], \ 'matlab': ['file.m'], \ 'maxima': ['file.demo', 'file.dmt', 'file.dm1', 'file.dm2', 'file.dm3', -- cgit From 807eb4434c890118e632ec57e396fd151c441714 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 25 Jul 2024 09:22:58 +0200 Subject: vim-patch:9.1.0612: filetype: deno.lock file not recognized MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: filetype: deno.lock file not recognized Solution: detect 'deno.lock' as json filetype (カワリミ人形) Reference: https://docs.deno.com/runtime/manual/basics/modules/integrity_checking/#caching-and-lock-files closes: vim/vim#15333 https://github.com/vim/vim/commit/df77c8ad3974e44df2e588de5f465072371cab69 Co-authored-by: カワリミ人形 --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 1d507af17c..16c4130420 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -369,7 +369,7 @@ func s:GetFilenameChecks() abort \ 'jq': ['file.jq'], \ 'jovial': ['file.jov', 'file.j73', 'file.jovial'], \ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file', 'org.eclipse.xyz.prefs'], - \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', '.lintstagedrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock', 'pack.mcmeta'], + \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', '.lintstagedrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci', 'flake.lock', 'pack.mcmeta', 'deno.lock'], \ 'json5': ['file.json5'], \ 'jsonc': ['file.jsonc', '.babelrc', '.eslintrc', '.jsfmtrc', '.jshintrc', '.jscsrc', '.vsconfig', '.hintrc', '.swrc', 'jsconfig.json', 'tsconfig.json', 'tsconfig.test.json', 'tsconfig-test.json', '.luaurc'], \ 'jsonl': ['file.jsonl'], -- cgit From dd61be59af5bb97f2f28ec0040ab1597795a48c5 Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Fri, 26 Jul 2024 00:32:54 +0200 Subject: vim-patch:9.1.0617: Cursor moves beyond first line of folded end of buffer (#29859) Problem: Cursor moves beyond start of a folded range at the end of a buffer. Solution: Move cursor to start of fold when going beyond end of buffer. Check that cursor moved to detect FAIL in outer cursor function. (Luuk van Baal) https://github.com/vim/vim/commit/dc373d456b5919ed2b8f83e8642c115f646ca93d --- test/old/testdir/test_fold.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_fold.vim b/test/old/testdir/test_fold.vim index aca497f28d..a9842ae437 100644 --- a/test/old/testdir/test_fold.vim +++ b/test/old/testdir/test_fold.vim @@ -1659,4 +1659,18 @@ func Test_foldexpr_end_fold() bwipe! endfunc +" Test moving cursor down to or beyond start of folded end of buffer. +func Test_cursor_down_fold_eob() + call setline(1, range(1, 4)) + norm Gzf2kj + call assert_equal(2, line('.')) + norm zojzc + call assert_equal(3, line('.')) + norm j + call assert_equal(3, line('.')) + norm k2j + call assert_equal(4, line('.')) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 41106168a2acaddc66eea5e3b21072829f052a65 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 26 Jul 2024 08:09:47 +0800 Subject: vim-patch:8.2.3543: swapname has double slash when 'directory' ends in it (#29862) Problem: Swapname has double slash when 'directory' ends in double slash. (Shane Smith) Solution: Remove the superfluous slash. (closes vim/vim#8876) https://github.com/vim/vim/commit/8b0e62c93b6dad5ec5b2c7558d4f7b78c46216d2 The test got lost in #29758... Co-authored-by: Bram Moolenaar --- test/old/testdir/test_swap.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_swap.vim b/test/old/testdir/test_swap.vim index 7c84c47337..8a1b3ce133 100644 --- a/test/old/testdir/test_swap.vim +++ b/test/old/testdir/test_swap.vim @@ -409,7 +409,7 @@ func Test_swap_symlink() " Check that this also works when 'directory' ends with '//' edit Xtestlink - call assert_match('Xtestfile\.swp$', s:swapname()) + call assert_match('Xswapdir[/\\]%.*testdir%Xtestfile\.swp$', s:swapname()) bwipe! set dir& -- cgit From 60967cd9aac545a5a5f17070d39121d4070e2298 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 27 Jul 2024 16:48:29 +0800 Subject: vim-patch:9.1.0616: filetype: Make syntax highlighting off for MS Makefiles (#29874) Problem: filetype: Make syntax highlighting off for MS Makefiles Solution: Try to detect MS Makefiles and adjust syntax rules to it. (Ken Takata) Highlighting of variable expansion in Microsoft Makefile can be broken. E.g.: https://github.com/vim/vim/blob/2979cfc2627d76a9c09cad46a1647dcd4aa73f5f/src/Make_mvc.mak#L1331 Don't use backslash as escape characters if `make_microsoft` is set. Also fix that `make_no_comments` was not considered if `make_microsoft` was set. Also add description for `make_microsoft` and `make_no_comments` to the documentation and include a very simple filetype test closes: vim/vim#15341 https://github.com/vim/vim/commit/eb4b903c9b238ebcc1d14cfcb207129b4931a33d Co-authored-by: Ken Takata --- test/old/testdir/test_filetype.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 16c4130420..83aff0205b 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -2641,4 +2641,21 @@ func Test_pl_file() filetype off endfunc +func Test_make_file() + filetype on + + " Microsoft Makefile + call writefile(['# Makefile for Windows', '!if "$(VIMDLL)" == "yes"'], 'XMakefile.mak', 'D') + split XMakefile.mak + call assert_equal(1, get(b:, 'make_microsoft', 0)) + bwipe! + + call writefile(['# get the list of tests', 'include testdir/Make_all.mak'], 'XMakefile.mak', 'D') + split XMakefile.mak + call assert_equal(0, get(b:, 'make_microsoft', 0)) + bwipe! + + filetype off +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From f132f8e9d43e3e5f56079bcae40d87b871d7b61b Mon Sep 17 00:00:00 2001 From: glepnir Date: Sat, 27 Jul 2024 17:57:19 +0800 Subject: vim-patch:9.1.0618: cannot mark deprecated attributes in completion menu Problem: cannot mark deprecated attributes in completion menu Solution: add hl_group to the Dictionary of supported completion fields (glepnir) closes: vim/vim#15314 https://github.com/vim/vim/commit/508e7856ec4afc9d6038b14bb6893668268dccab Co-authored-by: glepnir --- test/old/testdir/test_popup.vim | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 20d96a99ea..6881abcc0f 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1506,4 +1506,33 @@ func Test_pum_highlights_match() call StopVimInTerminal(buf) endfunc +func Test_pum_extrahl() + CheckScreendump + let lines =<< trim END + hi StrikeFake ctermfg=9 + func CompleteFunc( findstart, base ) + if a:findstart + return 0 + endif + return { + \ 'words': [ + \ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'W', 'extrahl': 'StrikeFake' }, + \ { 'word': 'aword2', 'menu': 'extra text 2', 'kind': 'W', }, + \ { 'word': '你好', 'menu': 'extra text 3', 'kind': 'W', 'extrahl': 'StrikeFake' }, + \]} + endfunc + set completeopt=menu + set completefunc=CompleteFunc + END + call writefile(lines, 'Xscript', 'D') + let buf = RunVimInTerminal('-S Xscript', {}) + call TermWait(buf) + call term_sendkeys(buf, "iaw\\") + call TermWait(buf, 50) + call VerifyScreenDump(buf, 'Test_pum_highlights_12', {}) + call term_sendkeys(buf, "\\u") + call TermWait(buf) + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From bc8a776ef8afd53ac7b045eeed8935284e1cc4d4 Mon Sep 17 00:00:00 2001 From: glepnir Date: Sat, 27 Jul 2024 18:06:21 +0800 Subject: vim-patch:9.1.0619: tests: test_popup fails Problem: tests: test_popup fails (after v9.1.0618) Solution: Correct test, move combining extra attributes to pum_compute_text_attrs() (glepnir) closes: vim/vim#15353 https://github.com/vim/vim/commit/8754efe437fcb17ad2c64192f8722e08d68e032e Co-authored-by: glepnir --- test/old/testdir/test_popup.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 6881abcc0f..1bba1d9397 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1516,9 +1516,9 @@ func Test_pum_extrahl() endif return { \ 'words': [ - \ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'W', 'extrahl': 'StrikeFake' }, + \ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'W', 'hl_group': 'StrikeFake' }, \ { 'word': 'aword2', 'menu': 'extra text 2', 'kind': 'W', }, - \ { 'word': '你好', 'menu': 'extra text 3', 'kind': 'W', 'extrahl': 'StrikeFake' }, + \ { 'word': '你好', 'menu': 'extra text 3', 'kind': 'W', 'hl_group': 'StrikeFake' }, \]} endfunc set completeopt=menu -- cgit From b8b0e9db3f91fbaa8835b90c683c33310064c8c8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 27 Jul 2024 21:44:05 +0800 Subject: vim-patch:9.1.0629: Rename of pum hl_group is incomplete Problem: Rename of pum hl_group is incomplete in source. Solution: Also rename the test function. Rename to user_hlattr in code to avoid confusion with pum_extra. Add test with matched text highlighting (zeertzjq). closes: vim/vim#15348 https://github.com/vim/vim/commit/4100852e099133a0c9603e1087e5dc6d82001ce7 --- test/old/testdir/test_popup.vim | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 1bba1d9397..5e234a397b 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1506,10 +1506,9 @@ func Test_pum_highlights_match() call StopVimInTerminal(buf) endfunc -func Test_pum_extrahl() +func Test_pum_user_hl_group() CheckScreendump let lines =<< trim END - hi StrikeFake ctermfg=9 func CompleteFunc( findstart, base ) if a:findstart return 0 @@ -1523,15 +1522,31 @@ func Test_pum_extrahl() endfunc set completeopt=menu set completefunc=CompleteFunc + + hi StrikeFake ctermfg=9 + func HlMatch() + hi PmenuMatchSel ctermfg=6 ctermbg=7 cterm=underline + hi PmenuMatch ctermfg=4 ctermbg=225 cterm=underline + endfunc END call writefile(lines, 'Xscript', 'D') let buf = RunVimInTerminal('-S Xscript', {}) + call TermWait(buf) - call term_sendkeys(buf, "iaw\\") - call TermWait(buf, 50) + call term_sendkeys(buf, "Saw\\") call VerifyScreenDump(buf, 'Test_pum_highlights_12', {}) - call term_sendkeys(buf, "\\u") + call term_sendkeys(buf, "\\") + call TermWait(buf) + call term_sendkeys(buf, ":call HlMatch()\") + + call TermWait(buf) + call term_sendkeys(buf, "Saw\\") + call VerifyScreenDump(buf, 'Test_pum_highlights_13', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_pum_highlights_14', {}) + call term_sendkeys(buf, "\\") + call StopVimInTerminal(buf) endfunc -- cgit From e596b6a18d84aa56b5189bb7921feec58279976c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 28 Jul 2024 22:29:20 +0200 Subject: vim-patch:9.1.0635: filetype: SuperHTML template files not recognized Problem: filetype: SuperHTML template files not recognized Solution: Update the filetype detection code to detect '*.shtml' either as HTML (Server Side Includes) or SuperHTML (template files) (EliSauder) related: vim/vim#15355 related: vim/vim#15367 https://github.com/vim/vim/commit/e57c9a19edc906a96ccb8821ae33fa6a8b20c3cd Co-authored-by: EliSauder <24995216+EliSauder@users.noreply.github.com> --- test/old/testdir/test_filetype.vim | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 83aff0205b..4daa321ec7 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -1598,6 +1598,38 @@ func Test_html_file() call assert_equal('htmldjango', &filetype) bwipe! + " Super html layout + let content = ['', + \ '', + \ '', + \ '
    ', + \ '
    '] + call writefile(content, 'Xfile.shtml', 'D') + split Xfile.shtml + call assert_equal('superhtml', &filetype) + bwipe! + + " Super html template + let content = ['', + \ '', + \ ' ', + \ ' ', + \ ' <super>', + \ ' suffix', + \ ' ', + \ ' ', + \ ' ', + \ ' ', + \ '
    ', + \ ' ', + \ '
    ', + \ ' ', + \ ''] + call writefile(content, 'Xfile.shtml', 'D') + split Xfile.shtml + call assert_equal('superhtml', &filetype) + bwipe! + " regular HTML let content = ['', '', ' Foobar', ' Content', ' ', ''] call writefile(content, 'Xfile.html', 'D') -- cgit From 01a56a056cd5da89350583ef9fbc97fa29dcd8ef Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 28 Jul 2024 22:32:05 +0200 Subject: vim-patch:9.1.0636: filetype: ziggy files are not recognized Problem: filetype: ziggy files are not recognized Solution: detect '*.ziggy' files as ziggy filetype, detect '*.ziggy-schema' files as ziggy-schema filetype (EliSauder) References: https://ziggy-lang.io/ fixes: vim/vim#15355 closes: vim/vim#15367 https://github.com/vim/vim/commit/f4572cee35a6c224985e71116e676ab711c09af3 Co-authored-by: EliSauder <24995216+EliSauder@users.noreply.github.com> --- test/old/testdir/test_filetype.vim | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 4daa321ec7..f9da5a914e 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -862,6 +862,8 @@ func s:GetFilenameChecks() abort \ 'z8a': ['file.z8a'], \ 'zathurarc': ['zathurarc'], \ 'zig': ['file.zig', 'build.zig.zon'], + \ 'ziggy': ['file.ziggy'], + \ 'ziggy_schema': ['file.ziggy-schema'], \ 'zimbu': ['file.zu'], \ 'zimbutempl': ['file.zut'], \ 'zserio': ['file.zs'], -- cgit From d131c48c823c30f519506eddcaef662dad5afa43 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 30 Jul 2024 06:26:09 +0800 Subject: vim-patch:9.1.0638: E1510 may happen when formatting a message for smsg() (#29907) Problem: E1510 may happen when formatting a message (after 9.1.0181). Solution: Only give E1510 when using typval. (zeertzjq) closes: vim/vim#15391 https://github.com/vim/vim/commit/0dff31576a340b74cec81517912923c38cb28450 --- test/old/testdir/test_spellfile.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_spellfile.vim b/test/old/testdir/test_spellfile.vim index 09b69dd93c..48e46641f4 100644 --- a/test/old/testdir/test_spellfile.vim +++ b/test/old/testdir/test_spellfile.vim @@ -846,6 +846,22 @@ func Test_spell_add_word() %bw! endfunc +func Test_spell_add_long_word() + set spell spellfile=./Xspellfile.add spelllang=en + + let word = repeat('a', 9000) + let v:errmsg = '' + " Spell checking doesn't really work for such a long word, + " but this should not cause an E1510 error. + exe 'spellgood ' .. word + call assert_equal('', v:errmsg) + call assert_equal([word], readfile('./Xspellfile.add')) + + set spell& spellfile= spelllang& encoding=utf-8 + call delete('./Xspellfile.add') + call delete('./Xspellfile.add.spl') +endfunc + func Test_spellfile_verbose() call writefile(['1', 'one'], 'XtestVerbose.dic', 'D') call writefile([], 'XtestVerbose.aff', 'D') -- cgit From 4b852bc555121f888a284dde45a56a0b7a42b851 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 30 Jul 2024 07:35:25 +0800 Subject: vim-patch:9.1.0642: Check that mapping rhs starts with lhs fails if not simplified (#29909) Problem: Check that mapping rhs starts with lhs doesn't work if lhs is not simplified. Solution: Keep track of the mapblock containing the alternative lhs and also compare with it (zeertzjq). fixes: vim/vim#15376 closes: vim/vim#15384 https://github.com/vim/vim/commit/9d997addc7bd0fd132a809cf497ed816e61fcd25 Cherry-pick removal of save_m_str from patch 8.2.4059. --- test/old/testdir/test_mapping.vim | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_mapping.vim b/test/old/testdir/test_mapping.vim index 2a4d068dea..4abe73ab3d 100644 --- a/test/old/testdir/test_mapping.vim +++ b/test/old/testdir/test_mapping.vim @@ -1672,6 +1672,49 @@ func Test_unmap_simplifiable() unmap endfunc +" Test that the first byte of rhs is not remapped if rhs starts with lhs. +func Test_map_rhs_starts_with_lhs() + new + func MapExpr() + return "\\" + endfunc + + for expr in [v:false, v:true] + if expr + imap MapExpr() + else + imap + endif + + for restore in [v:false, v:true] + if restore + let saved = maparg('', 'i', v:false, v:true) + iunmap + call mapset(saved) + endif + + let @a = 'foo' + call feedkeys("S\a", 'tx') + call assert_equal('foo', getline('.')) + + let @a = 'bar' + call feedkeys("S\<*C-R>a", 'tx') + call assert_equal('bar', getline('.')) + endfor + endfor + + " When two mappings are used for and , remapping should work. + imap bar + imap foo + call feedkeys("S\", 'xt') + call assert_equal('foo', getline('.')) + call feedkeys("S\<*C-I>", 'xt') + call assert_equal('foobar', getline('.')) + + delfunc MapExpr + bwipe! +endfunc + func Test_expr_map_escape_special() nnoremap … let g:got_ellipsis += 1 func Func() -- cgit From 96b358e9f138e60a24c3f3c9b45e9b82ffb92c1c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 30 Jul 2024 11:08:16 +0800 Subject: vim-patch:partial:9.0.0327: items() does not work on a list Problem: items() does not work on a list. (Sergey Vlasov) Solution: Make items() work on a list. (closes vim/vim#11013) https://github.com/vim/vim/commit/976f859763b215050a03248dbc2bb62fa5d0d059 Skip CHECK_LIST_MATERIALIZE. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_listdict.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index 35d63c87d0..e976dc4c29 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -195,6 +195,17 @@ func Test_list_range_assign() call CheckDefAndScriptFailure(lines, 'E1012:', 2) endfunc +func Test_list_items() + let r = [] + let l = ['a', 'b', 'c'] + for [idx, val] in items(l) + call extend(r, [[idx, val]]) + endfor + call assert_equal([[0, 'a'], [1, 'b'], [2, 'c']], r) + + call assert_fails('call items(3)', 'E1227:') +endfunc + " Test removing items in list func Test_list_func_remove() let lines =<< trim END -- cgit From 2dd0a90f211268517af30607c8eade0fef533edb Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 30 Jul 2024 11:53:00 +0800 Subject: vim-patch:9.0.0330: method tests fail Problem: Method tests fail. Solution: Adjust for change of items(). https://github.com/vim/vim/commit/f92cfb1acc3fef74eef0c83c1a35a2b6a9f93a9b Co-authored-by: Bram Moolenaar --- test/old/testdir/test_method.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_method.vim b/test/old/testdir/test_method.vim index 0c1d15f4ed..fd6e1b1523 100644 --- a/test/old/testdir/test_method.vim +++ b/test/old/testdir/test_method.vim @@ -20,9 +20,8 @@ func Test_list_method() call assert_equal(2, l->get(1)) call assert_equal(1, l->index(2)) call assert_equal([0, 1, 2, 3], [1, 2, 3]->insert(0)) - call assert_fails('eval l->items()', 'E715:') call assert_equal('1 2 3', l->join()) - call assert_fails('eval l->keys()', 'E715:') + call assert_fails('eval l->keys()', 'E1206:') call assert_equal(3, l->len()) call assert_equal([2, 3, 4], [1, 2, 3]->map('v:val + 1')) call assert_equal(3, l->max()) @@ -34,7 +33,7 @@ func Test_list_method() call assert_equal('[1, 2, 3]', l->string()) call assert_equal(v:t_list, l->type()) call assert_equal([1, 2, 3], [1, 1, 2, 3, 3]->uniq()) - call assert_fails('eval l->values()', 'E715:') + call assert_fails('eval l->values()', 'E1206:') call assert_fails('echo []->len', 'E107:') endfunc @@ -79,6 +78,7 @@ func Test_string_method() eval "a\rb\ec"->strtrans()->assert_equal('a^Mb^[c') eval "aあb"->strwidth()->assert_equal(4) eval 'abc'->substitute('b', 'x', '')->assert_equal('axc') + call assert_fails('eval "x"->items()', 'E1227:') eval 'abc'->printf('the %s arg')->assert_equal('the abc arg') endfunc -- cgit From 8ca3c1515c3fd5f70e870e535649a4c2afc5bbaf Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 30 Jul 2024 11:34:38 +0800 Subject: vim-patch:9.0.0331: cannot use items() on a string Problem: Cannot use items() on a string. Solution: Make items() work on a string. (closes vim/vim#11016) https://github.com/vim/vim/commit/3e518a8ec74065aedd67d352c93d6ae6be550316 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_listdict.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index e976dc4c29..5e4a3fd1f8 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -203,7 +203,16 @@ func Test_list_items() endfor call assert_equal([[0, 'a'], [1, 'b'], [2, 'c']], r) - call assert_fails('call items(3)', 'E1227:') + call assert_fails('call items(3)', 'E1225:') +endfunc + +func Test_string_items() + let r = [] + let s = 'ábツ' + for [idx, val] in items(s) + call extend(r, [[idx, val]]) + endfor + call assert_equal([[0, 'á'], [1, 'b'], [2, 'ツ']], r) endfunc " Test removing items in list -- cgit From 520d94cc23416e14a4535c9ca6b7963681a7f461 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 30 Jul 2024 11:54:23 +0800 Subject: vim-patch:9.0.0333: method test fails Problem: Method test fails. Solution: Adjust test for items() now working on string. https://github.com/vim/vim/commit/171a1607f4b0b3cdcbbe5e886da37a5d11f15684 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_method.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_method.vim b/test/old/testdir/test_method.vim index fd6e1b1523..1b57bba282 100644 --- a/test/old/testdir/test_method.vim +++ b/test/old/testdir/test_method.vim @@ -78,7 +78,7 @@ func Test_string_method() eval "a\rb\ec"->strtrans()->assert_equal('a^Mb^[c') eval "aあb"->strwidth()->assert_equal(4) eval 'abc'->substitute('b', 'x', '')->assert_equal('axc') - call assert_fails('eval "x"->items()', 'E1227:') + call assert_fails('eval 123->items()', 'E1225:') eval 'abc'->printf('the %s arg')->assert_equal('the abc arg') endfunc -- cgit From 63cd2adf3d27436dbaf6a8eda72608d3009ccd3c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 31 Jul 2024 06:21:55 +0800 Subject: vim-patch:9.1.0644: Unnecessary STRLEN() when applying mapping (#29921) Problem: Unnecessary STRLEN() when applying mapping. (after v9.1.0642) Solution: Use m_keylen and vim_strnsave(). (zeertzjq) closes: vim/vim#15394 https://github.com/vim/vim/commit/74011dc1fa7bca6c901937173a42e0edce68e080 --- test/old/testdir/test_mapping.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_mapping.vim b/test/old/testdir/test_mapping.vim index 4abe73ab3d..e4e446c55c 100644 --- a/test/old/testdir/test_mapping.vim +++ b/test/old/testdir/test_mapping.vim @@ -1694,11 +1694,11 @@ func Test_map_rhs_starts_with_lhs() endif let @a = 'foo' - call feedkeys("S\a", 'tx') + call assert_nobeep('call feedkeys("S\a", "tx")') call assert_equal('foo', getline('.')) let @a = 'bar' - call feedkeys("S\<*C-R>a", 'tx') + call assert_nobeep('call feedkeys("S\<*C-R>a", "tx")') call assert_equal('bar', getline('.')) endfor endfor -- cgit From 17f95fe79bc32d3e6c008716e2bc623cbecf7a0d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 31 Jul 2024 06:37:58 +0800 Subject: vim-patch:9.0.0105: illegal memory access when pattern starts with illegal byte Problem: Illegal memory access when pattern starts with illegal byte. Solution: Do not match a character with an illegal byte. https://github.com/vim/vim/commit/f50940531dd57135fe60aa393ac9d3281f352d88 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_regexp_utf8.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_regexp_utf8.vim b/test/old/testdir/test_regexp_utf8.vim index f9ad1fc7ca..07695f9cc8 100644 --- a/test/old/testdir/test_regexp_utf8.vim +++ b/test/old/testdir/test_regexp_utf8.vim @@ -1,5 +1,7 @@ " Tests for regexp in utf8 encoding +source shared.vim + func s:equivalence_test() let str = "AÀÁÂÃÄÅĀĂĄǍǞǠǺȂȦȺḀẠẢẤẦẨẪẬẮẰẲẴẶ BƁɃḂḄḆ CÇĆĈĊČƇȻḈꞒ DĎĐƊḊḌḎḐḒ EÈÉÊËĒĔĖĘĚȄȆȨɆḔḖḘḚḜẸẺẼẾỀỂỄỆ FƑḞꞘ GĜĞĠĢƓǤǦǴḠꞠ HĤĦȞḢḤḦḨḪⱧ IÌÍÎÏĨĪĬĮİƗǏȈȊḬḮỈỊ JĴɈ KĶƘǨḰḲḴⱩꝀ LĹĻĽĿŁȽḶḸḺḼⱠ MḾṀṂ NÑŃŅŇǸṄṆṈṊꞤ OÒÓÔÕÖØŌŎŐƟƠǑǪǬǾȌȎȪȬȮȰṌṎṐṒỌỎỐỒỔỖỘỚỜỞỠỢ PƤṔṖⱣ QɊ RŔŖŘȐȒɌṘṚṜṞⱤꞦ SŚŜŞŠȘṠṢṤṦṨⱾꞨ TŢŤŦƬƮȚȾṪṬṮṰ UÙÚÛÜŨŪŬŮŰƯǕǙǛǓǗȔȖɄṲṴṶṸṺỤỦỨỪỬỮỰ VƲṼṾ WŴẀẂẄẆẈ XẊẌ YÝŶŸƳȲɎẎỲỴỶỸ ZŹŻŽƵẐẒẔⱫ aàáâãäåāăąǎǟǡǻȃȧᶏḁẚạảấầẩẫậắằẳẵặⱥ bƀɓᵬᶀḃḅḇ cçćĉċčƈȼḉꞓꞔ dďđɗᵭᶁᶑḋḍḏḑḓ eèéêëēĕėęěȅȇȩɇᶒḕḗḙḛḝẹẻẽếềểễệ fƒᵮᶂḟꞙ gĝğġģǥǧǵɠᶃḡꞡ hĥħȟḣḥḧḩḫẖⱨꞕ iìíîïĩīĭįǐȉȋɨᶖḭḯỉị jĵǰɉ kķƙǩᶄḱḳḵⱪꝁ lĺļľŀłƚḷḹḻḽⱡ mᵯḿṁṃ nñńņňʼnǹᵰᶇṅṇṉṋꞥ oòóôõöøōŏőơǒǫǭǿȍȏȫȭȯȱɵṍṏṑṓọỏốồổỗộớờởỡợ pƥᵱᵽᶈṕṗ qɋʠ rŕŗřȑȓɍɽᵲᵳᶉṛṝṟꞧ sśŝşšșȿᵴᶊṡṣṥṧṩꞩ tţťŧƫƭțʈᵵṫṭṯṱẗⱦ uùúûüũūŭůűųǚǖưǔǘǜȕȗʉᵾᶙṳṵṷṹṻụủứừửữự vʋᶌṽṿ wŵẁẃẅẇẉẘ xẋẍ yýÿŷƴȳɏẏẙỳỵỷỹ zźżžƶᵶᶎẑẓẕⱬ" let groups = split(str) @@ -559,6 +561,19 @@ func Test_match_invalid_byte() call delete('Xinvalid') endfunc +func Test_match_illegal_byte() + let lines =<< trim END + silent! buffer ÿ\c + next ÿ + 0scriptnames + source + END + call writefile(lines, 'Xregexp') + call system(GetVimCommand() .. ' -X -Z -e -s -S Xregexp -c qa!') + + call delete('Xregexp') +endfunc + func Test_match_too_complicated() set regexpengine=1 exe "noswapfile vsplit \xeb\xdb\x99" -- cgit From e57598fbef1de7c9089a58e3b428b87ba155cd0b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 31 Jul 2024 06:06:09 +0800 Subject: vim-patch:9.1.0645: regex: wrong match when searching multi-byte char case-insensitive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: regex: wrong match when searching multi-byte char case-insensitive (diffsetter) Solution: Apply proper case-folding for characters and search-string This patch does the following 4 things: 1) When the regexp engine compares two utf-8 codepoints case insensitive it may match an adjacent character, because it assumes it can step over as many bytes as the pattern contains. This however is not necessarily true because of case-folding, a multi-byte UTF-8 character can be considered equal to some single-byte value. Let's consider the pattern 'ſ' and the string 's'. When comparing and ignoring case, the single character 's' matches, and since it matches Vim will try to step over the match (by the amount of bytes of the pattern), assuming that since it matches, the length of both strings is the same. However in that case, it should only step over the single byte value 's' by 1 byte and try to start matching after it again. So for the backtracking engine we need to ensure: * we try to match the correct length for the pattern and the text * in case of a match, we step over it correctly There is one tricky thing for the backtracing engine. We also need to calculate correctly the number of bytes to compare the 2 different utf-8 strings s1 and s2. So we will count the number of characters in s1 that the byte len specified. Then we count the number of bytes to step over the same number of characters in string s2 and then we can correctly compare the 2 utf-8 strings. 2) A similar thing can happen for the NFA engine, when skipping to the next character to test for a match. We are skipping over the regstart pointer, however we do not consider the case that because of case-folding we may need to adjust the number of bytes to skip over. So this needs to be adjusted in find_match_text() as well. 3) A related issue turned out, when prog->match_text is actually empty. In that case we should try to find the next match and skip this condition. 4) When comparing characters using collections, we must also apply case folding to each character in the collection and not just to the current character from the search string. This doesn't apply to the NFA engine, because internally it converts collections to branches [abc] -> a\|b\|c fixes: vim/vim#14294 closes: vim/vim#14756 https://github.com/vim/vim/commit/22e8e12d9f5034e1984db0c567b281fda4de8dd7 N/A patches: vim-patch:9.0.1771: regex: combining chars in collections not handled vim-patch:9.0.1777: patch 9.0.1771 causes problems Co-authored-by: Christian Brabandt --- test/old/testdir/test_regexp_utf8.vim | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_regexp_utf8.vim b/test/old/testdir/test_regexp_utf8.vim index 07695f9cc8..505e99919c 100644 --- a/test/old/testdir/test_regexp_utf8.vim +++ b/test/old/testdir/test_regexp_utf8.vim @@ -594,4 +594,36 @@ func Test_combining_chars_in_collection() bw! endfunc +func Test_search_multibyte_match_ascii() + new + " Match single 'ſ' and 's' + call setline(1, 'das abc heraus abc ſich abc ſind') + for i in range(0, 2) + exe "set re="..i + let ic_match = matchbufline('%', '\c\%u17f', 1, '$')->mapnew({idx, val -> val.text}) + let noic_match = matchbufline('%', '\C\%u17f', 1, '$')->mapnew({idx, val -> val.text}) + call assert_equal(['s', 's', 'ſ','ſ'], ic_match, "Ignorecase Regex-engine: " .. &re) + call assert_equal(['ſ','ſ'], noic_match, "No-Ignorecase Regex-engine: " .. &re) + endfor + " Match several 'ſſ' and 'ss' + call setline(1, 'das abc herauss abc ſſich abc ſind') + for i in range(0, 2) + exe "set re="..i + let ic_match = matchbufline('%', '\c\%u17f\%u17f', 1, '$')->mapnew({idx, val -> val.text}) + let noic_match = matchbufline('%', '\C\%u17f\%u17f', 1, '$')->mapnew({idx, val -> val.text}) + let ic_match2 = matchbufline('%', '\c\%u17f\+', 1, '$')->mapnew({idx, val -> val.text}) + let noic_match2 = matchbufline('%', '\C\%u17f\+', 1, '$')->mapnew({idx, val -> val.text}) + let ic_match3 = matchbufline('%', '\c[\u17f]\+', 1, '$')->mapnew({idx, val -> val.text}) + let noic_match3 = matchbufline('%', '\C[\u17f]\+', 1, '$')->mapnew({idx, val -> val.text}) + + call assert_equal(['ss', 'ſſ'], ic_match, "Ignorecase Regex-engine: " .. &re) + call assert_equal(['ſſ'], noic_match, "No-Ignorecase Regex-engine: " .. &re) + call assert_equal(['s', 'ss', 'ſſ', 'ſ'], ic_match2, "Ignorecase Regex-engine: " .. &re) + call assert_equal(['ſſ','ſ'], noic_match2, "No-Ignorecase Regex-engine: " .. &re) + call assert_equal(['s', 'ss', 'ſſ', 'ſ'], ic_match3, "Ignorecase Collection Regex-engine: " .. &re) + call assert_equal(['ſſ','ſ'], noic_match3, "No-Ignorecase Collection Regex-engine: " .. &re) + endfor + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 619cb143f93fbf75adde9710415a74d36c8eb63d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 30 Jul 2024 13:38:13 +0800 Subject: vim-patch:9.1.0415: Some functions are not tested Problem: Some functions are not tested Solution: Add a few more tests, fix a few minor problems (Yegappan Lakshmanan) closes: vim/vim#14789 https://github.com/vim/vim/commit/fe424d13ef6e5486923f23f15bb6951e3079412e Co-authored-by: Yegappan Lakshmanan --- test/old/testdir/test_blob.vim | 20 ++++++++++++++++++++ test/old/testdir/test_edit.vim | 5 +++++ test/old/testdir/test_fold.vim | 28 ++++++++++++++++++++++++++++ test/old/testdir/test_functions.vim | 2 ++ test/old/testdir/test_listdict.vim | 21 +++++++++++++++++++++ test/old/testdir/test_method.vim | 7 +++++++ test/old/testdir/test_partial.vim | 14 ++++++++++++++ test/old/testdir/test_vimscript.vim | 7 +++++++ 8 files changed, 104 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_blob.vim b/test/old/testdir/test_blob.vim index 3886be48bd..fbc080059e 100644 --- a/test/old/testdir/test_blob.vim +++ b/test/old/testdir/test_blob.vim @@ -75,6 +75,13 @@ func Test_blob_assign() VAR l = [0z12] VAR m = deepcopy(l) LET m[0] = 0z34 #" E742 or E741 should not occur. + + VAR blob1 = 0z10 + LET blob1 += v:_null_blob + call assert_equal(0z10, blob1) + LET blob1 = v:_null_blob + LET blob1 += 0z20 + call assert_equal(0z20, blob1) END call CheckLegacyAndVim9Success(lines) @@ -332,6 +339,17 @@ func Test_blob_for_loop() call assert_equal(5, i) END call CheckLegacyAndVim9Success(lines) + + " Test for skipping the loop var assignment in a for loop + let lines =<< trim END + VAR blob = 0z998877 + VAR c = 0 + for _ in blob + LET c += 1 + endfor + call assert_equal(3, c) + END + call CheckLegacyAndVim9Success(lines) endfunc func Test_blob_concatenate() @@ -851,6 +869,7 @@ func Test_indexof() call assert_equal(-1, indexof(b, v:_null_string)) " Nvim doesn't have null functions " call assert_equal(-1, indexof(b, test_null_function())) + call assert_equal(-1, indexof(b, "")) let b = 0z01020102 call assert_equal(1, indexof(b, "v:val == 0x02", #{startidx: 0})) @@ -862,6 +881,7 @@ func Test_indexof() " failure cases call assert_fails('let i = indexof(b, "val == 0xde")', 'E121:') call assert_fails('let i = indexof(b, {})', 'E1256:') + call assert_fails('let i = indexof(b, " ")', 'E15:') endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_edit.vim b/test/old/testdir/test_edit.vim index d43dcc40c1..037282bf1a 100644 --- a/test/old/testdir/test_edit.vim +++ b/test/old/testdir/test_edit.vim @@ -1973,6 +1973,11 @@ func Test_edit_insert_reg() let @r = 'sample' call feedkeys("a\=SaveFirstLine()\", "xt") call assert_equal('"', g:Line) + + " Test for inserting an null and an empty list + call feedkeys("a\=test_null_list()\", "xt") + call feedkeys("a\=[]\", "xt") + call assert_equal(['r'], getbufline('', 1, '$')) call test_override('ALL', 0) close! endfunc diff --git a/test/old/testdir/test_fold.vim b/test/old/testdir/test_fold.vim index a9842ae437..7b4e56508d 100644 --- a/test/old/testdir/test_fold.vim +++ b/test/old/testdir/test_fold.vim @@ -1469,6 +1469,34 @@ func Test_foldtext_scriptlocal_func() delfunc s:FoldText endfunc +" Test for setting 'foldtext' from the modeline and executing the expression +" in a sandbox +func Test_foldtext_in_modeline() + func ModelineFoldText() + call feedkeys('aFoo', 'xt') + return "folded text" + endfunc + let lines =<< trim END + func T() + let i = 1 + endfunc + " vim: foldenable foldtext=ModelineFoldText() + END + call writefile(lines, 'Xmodelinefoldtext', 'D') + + set modeline modelineexpr + split Xmodelinefoldtext + + call cursor(1, 1) + normal! zf3j + call assert_equal('folded text', foldtextresult(1)) + call assert_equal(lines, getbufline('', 1, '$')) + + bw! + set modeline& modelineexpr& + delfunc ModelineFoldText +endfunc + " Make sure a fold containing a nested fold is split correctly when using " foldmethod=indent func Test_fold_split() diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 3faa720850..01e9ae3bf2 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -3731,6 +3731,8 @@ func Test_slice() call assert_equal('', 'ὰ̳β̳́γ̳̂δ̳̃ε̳̄ζ̳̅'->slice(1, -6)) END call CheckLegacyAndVim9Success(lines) + + call assert_equal(0, slice(v:true, 1)) endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index 5e4a3fd1f8..678734dafb 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -57,6 +57,9 @@ func Test_list_slice() assert_equal([1, 2], l[-3 : -1]) END call CheckDefAndScriptSuccess(lines) + + call assert_fails('let l[[]] = 1', 'E730: Using a List as a String') + call assert_fails('let l[1 : []] = [1]', 'E730: Using a List as a String') endfunc " List identity @@ -175,6 +178,19 @@ func Test_list_assign() END call CheckScriptFailure(['vim9script'] + lines, 'E688:') call CheckDefExecFailure(lines, 'E1093: Expected 2 items but got 1') + + let lines =<< trim END + VAR l = [2] + LET l += v:_null_list + call assert_equal([2], l) + LET l = v:_null_list + LET l += [1] + call assert_equal([1], l) + END + call CheckLegacyAndVim9Success(lines) + + let d = {'abc': [1, 2, 3]} + call assert_fails('let d.abc[0:0z10] = [10, 20]', 'E976: Using a Blob as a String') endfunc " test for range assign @@ -440,6 +456,9 @@ func Test_dict_assign() n.key = 3 END call CheckDefFailure(lines, 'E1141:') + + let d = {'abc': {}} + call assert_fails("let d.abc[0z10] = 10", 'E976: Using a Blob as a String') endfunc " Function in script-local List or Dict @@ -1449,6 +1468,8 @@ func Test_indexof() call assert_equal(-1, indexof(l, v:_null_string)) " Nvim doesn't have null functions " call assert_equal(-1, indexof(l, test_null_function())) + call assert_equal(-1, indexof(l, "")) + call assert_fails('let i = indexof(l, " ")', 'E15:') " failure cases call assert_fails('let i = indexof(l, "v:val == ''cyan''")', 'E735:') diff --git a/test/old/testdir/test_method.vim b/test/old/testdir/test_method.vim index 1b57bba282..ca1ca7d573 100644 --- a/test/old/testdir/test_method.vim +++ b/test/old/testdir/test_method.vim @@ -134,6 +134,13 @@ func Test_method_syntax() call assert_fails('eval [1, 2, 3]-> sort()', 'E15:') call assert_fails('eval [1, 2, 3]->sort ()', 'E274:') call assert_fails('eval [1, 2, 3]-> sort ()', 'E15:') + + " Test for using a method name containing a curly brace name + let s = 'len' + call assert_equal(4, "xxxx"->str{s}()) + + " Test for using a method in an interpolated string + call assert_equal('4', $'{"xxxx"->strlen()}') endfunc func Test_method_lambda() diff --git a/test/old/testdir/test_partial.vim b/test/old/testdir/test_partial.vim index d049cc9e4b..b5933cdd6d 100644 --- a/test/old/testdir/test_partial.vim +++ b/test/old/testdir/test_partial.vim @@ -403,4 +403,18 @@ func Test_compare_partials() call assert_false(F1 is N1) endfunc +func Test_partial_method() + func Foo(x, y, z) + return x + y + z + endfunc + let d = {"Fn": function('Foo', [10, 20])} + call assert_fails('echo 30->d.Fn()', 'E1265: Cannot use a partial here') + delfunc Foo +endfunc + +func Test_non_callable_type_as_method() + let d = {"Fn": 10} + call assert_fails('echo 30->d.Fn()', 'E1085: Not a callable type: d.Fn') +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_vimscript.vim b/test/old/testdir/test_vimscript.vim index 28868a07d6..108321e8ad 100644 --- a/test/old/testdir/test_vimscript.vim +++ b/test/old/testdir/test_vimscript.vim @@ -7449,6 +7449,13 @@ func Test_for_over_string() let res ..= c .. '-' endfor call assert_equal('', res) + + " Test for ignoring loop var assignment + let c = 0 + for _ in 'abc' + let c += 1 + endfor + call assert_equal(3, c) endfunc " Test for deeply nested :source command {{{1 -- cgit From 30f85fcb7f86857d70601569847e6bd0019fa54c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 31 Jul 2024 09:39:31 +0800 Subject: vim-patch:9.1.0419: eval.c not sufficiently tested Problem: eval.c not sufficiently tested Solution: Add a few more additional tests for eval.c, (Yegappan Lakshmanan) closes: vim/vim#14799 https://github.com/vim/vim/commit/4776e64e72de2976ff90b17d236e50e2b02c5540 Co-authored-by: Yegappan Lakshmanan --- test/old/testdir/test_autoload.vim | 1 - test/old/testdir/test_fold.vim | 29 +++++++++++++++++++++++++++++ test/old/testdir/test_spellrare.vim | 18 +++++++++--------- test/old/testdir/test_substitute.vim | 14 ++++++++++++++ test/old/testdir/test_vimscript.vim | 11 ++++++----- 5 files changed, 58 insertions(+), 15 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_autoload.vim b/test/old/testdir/test_autoload.vim index e89fe3943b..156387a2d2 100644 --- a/test/old/testdir/test_autoload.vim +++ b/test/old/testdir/test_autoload.vim @@ -21,5 +21,4 @@ func Test_source_autoload() call assert_equal(1, g:loaded_sourced_vim) endfunc - " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_fold.vim b/test/old/testdir/test_fold.vim index 7b4e56508d..36f72f5e01 100644 --- a/test/old/testdir/test_fold.vim +++ b/test/old/testdir/test_fold.vim @@ -1497,6 +1497,35 @@ func Test_foldtext_in_modeline() delfunc ModelineFoldText endfunc +" Test for setting 'foldexpr' from the modeline and executing the expression +" in a sandbox +func Test_foldexpr_in_modeline() + func ModelineFoldExpr() + call feedkeys('aFoo', 'xt') + return strlen(matchstr(getline(v:lnum),'^\s*')) + endfunc + let lines =<< trim END + aaa + bbb + ccc + ccc + bbb + aaa + " vim: foldenable foldmethod=expr foldexpr=ModelineFoldExpr() + END + call writefile(lines, 'Xmodelinefoldexpr', 'D') + + set modeline modelineexpr + split Xmodelinefoldexpr + + call assert_equal(2, foldlevel(3)) + call assert_equal(lines, getbufline('', 1, '$')) + + bw! + set modeline& modelineexpr& + delfunc ModelineFoldExpr +endfunc + " Make sure a fold containing a nested fold is split correctly when using " foldmethod=indent func Test_fold_split() diff --git a/test/old/testdir/test_spellrare.vim b/test/old/testdir/test_spellrare.vim index bbb13c27c2..ceb35cbd17 100644 --- a/test/old/testdir/test_spellrare.vim +++ b/test/old/testdir/test_spellrare.vim @@ -11,15 +11,15 @@ func Test_spellrareword() " Create a small word list to test that spellbadword('...') " can return ['...', 'rare']. let lines =<< trim END - foo - foobar/? - foobara/? -END - call writefile(lines, 'Xwords', 'D') - - mkspell! Xwords.spl Xwords - set spelllang=Xwords.spl - call assert_equal(['foobar', 'rare'], spellbadword('foo foobar')) + foo + foobar/? + foobara/? + END + call writefile(lines, 'Xwords', 'D') + + mkspell! Xwords.spl Xwords + set spelllang=Xwords.spl + call assert_equal(['foobar', 'rare'], spellbadword('foo foobar')) new call setline(1, ['foo', '', 'foo bar foo bar foobara foo foo foo foobar', '', 'End']) diff --git a/test/old/testdir/test_substitute.vim b/test/old/testdir/test_substitute.vim index f69a3c525b..f0a25b2804 100644 --- a/test/old/testdir/test_substitute.vim +++ b/test/old/testdir/test_substitute.vim @@ -1507,4 +1507,18 @@ func Test_substitute_expr_recursive() exe bufnr .. "bw!" endfunc +" Test for changing 'cpo' in a substitute expression +func Test_substitute_expr_cpo() + func XSubExpr() + set cpo= + return 'x' + endfunc + + let save_cpo = &cpo + call assert_equal('xxx', substitute('abc', '.', '\=XSubExpr()', 'g')) + call assert_equal(save_cpo, &cpo) + + delfunc XSubExpr +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_vimscript.vim b/test/old/testdir/test_vimscript.vim index 108321e8ad..7f29c7f651 100644 --- a/test/old/testdir/test_vimscript.vim +++ b/test/old/testdir/test_vimscript.vim @@ -7450,12 +7450,13 @@ func Test_for_over_string() endfor call assert_equal('', res) - " Test for ignoring loop var assignment - let c = 0 - for _ in 'abc' - let c += 1 + " Test for using "_" as the loop variable + let i = 0 + let s = 'abc' + for _ in s + call assert_equal(s[i], _) + let i += 1 endfor - call assert_equal(3, c) endfunc " Test for deeply nested :source command {{{1 -- cgit From db928f0dd30ee403819a491ab993aaa55855f6a0 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 1 Aug 2024 14:45:57 +0800 Subject: vim-patch:8.2.4275: cannot use an autoload function from a package under start (#29937) Problem: Cannot use an autoload function from a package under start. Solution: Also look in the "start" package directory. (Bjorn Linse, closes vim/vim#7193) https://github.com/vim/vim/commit/223a950a85448253780da4e821a5b23dcdfad28f Nvim already does this in do_in_cached_path(), and this change has no effect in Nvim as Nvim removes DIP_START after do_in_cached_path(). Accidentally failed to mark as ported: vim-patch:8.2.1731: Vim9: cannot use += to append to empty NULL list Co-authored-by: bfredl --- test/old/testdir/test_packadd.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_packadd.vim b/test/old/testdir/test_packadd.vim index 730cb3278b..47cf520bb9 100644 --- a/test/old/testdir/test_packadd.vim +++ b/test/old/testdir/test_packadd.vim @@ -258,6 +258,19 @@ func Test_packloadall() call assert_equal(4321, g:plugin_bar_number) endfunc +func Test_start_autoload() + " plugin foo with an autoload directory + let autodir = &packpath .. '/pack/mine/start/foo/autoload' + call mkdir(autodir, 'p') + let fname = autodir .. '/foobar.vim' + call writefile(['func foobar#test()', + \ ' return 1666', + \ 'endfunc'], fname) + + call assert_equal(1666, foobar#test()) + call delete(fname) +endfunc + func Test_helptags() let docdir1 = &packpath . '/pack/mine/start/foo/doc' let docdir2 = &packpath . '/pack/mine/start/bar/doc' -- cgit From 9f2d793068144ef92765fefd729b0eeffde11b7a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 2 Aug 2024 05:56:27 +0800 Subject: vim-patch:9.0.2149: [security]: use-after-free in exec_instructions() Problem: [security]: use-after-free in exec_instructions() Solution: get tv pointer again [security]: use-after-free in exec_instructions() exec_instructions may access freed memory, if the GA_GROWS_FAILS() re-allocates memory. When this happens, the typval tv may still point to now already freed memory. So let's get that pointer again and compare it with tv. If those two pointers differ, tv is now invalid and we have to refresh the tv pointer. closes: vim/vim#13621 https://github.com/vim/vim/commit/5dd41d4b6370b7b7d09d691f9252b3899c66102a Co-authored-by: Christian Brabandt --- test/old/testdir/crash/poc_uaf_exec_instructions | Bin 0 -> 69 bytes test/old/testdir/test_crash.vim | 39 +++++++++++++++-------- 2 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 test/old/testdir/crash/poc_uaf_exec_instructions (limited to 'test/old/testdir') diff --git a/test/old/testdir/crash/poc_uaf_exec_instructions b/test/old/testdir/crash/poc_uaf_exec_instructions new file mode 100644 index 0000000000..49ae8577ff Binary files /dev/null and b/test/old/testdir/crash/poc_uaf_exec_instructions differ diff --git a/test/old/testdir/test_crash.vim b/test/old/testdir/test_crash.vim index 49e712a901..242da8e5db 100644 --- a/test/old/testdir/test_crash.vim +++ b/test/old/testdir/test_crash.vim @@ -113,6 +113,7 @@ endfunc func Test_crash1_2() CheckNotBSD CheckExecutable dash + let g:test_is_flaky = 1 " The following used to crash Vim let opts = #{cmd: 'sh'} @@ -149,22 +150,9 @@ func Test_crash1_2() \ ' ; echo "crash 4: [OK]" >> '.. result .. "\") call TermWait(buf, 150) - let file = 'crash/poc_ex_substitute' - let cmn_args = "%s -u NONE -i NONE -n -e -s -S %s -c ':qa!'" - let args = printf(cmn_args, vim, file) - " just make sure it runs, we don't care about the resulting echo - call term_sendkeys(buf, args .. "\") - " There is no output generated in Github CI for the asan clang build. - " so just skip generating the ouput. - " call term_sendkeys(buf, args .. - " \ ' && echo "crash 5: [OK]" >> '.. result .. "\") - call TermWait(buf, 150) - " clean up exe buf .. "bw!" - exe "sp " .. result - let expected = [ \ 'crash 1: [OK]', \ 'crash 2: [OK]', @@ -174,10 +162,33 @@ func Test_crash1_2() call assert_equal(expected, getline(1, '$')) bw! - call delete(result) endfunc +" This test just runs various scripts, that caused issues before. +" We are not really asserting anything here, it's just important +" that ASAN does not detect any issues. +func Test_crash1_3() + let vim = GetVimProg() + let buf = RunVimInTerminal('sh', #{cmd: 'sh'}) + + let file = 'crash/poc_ex_substitute' + let cmn_args = "%s -u NONE -i NONE -n -e -s -S %s -c ':qa!'\" + let args = printf(cmn_args, vim, file) + call term_sendkeys(buf, args) + call TermWait(buf, 150) + + let file = 'crash/poc_uaf_exec_instructions' + let cmn_args = "%s -u NONE -i NONE -n -e -s -S %s -c ':qa!'\" + let args = printf(cmn_args, vim, file) + call term_sendkeys(buf, args) + call TermWait(buf, 150) + + " clean up + exe buf .. "bw!" + bw! +endfunc + func Test_crash2() " The following used to crash Vim let opts = #{wait_for_ruler: 0, rows: 20} -- cgit From a4bec30b7b2fa66a2db9d03f54e51dff58116465 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 2 Aug 2024 05:58:20 +0800 Subject: vim-patch:9.0.2158: [security]: use-after-free in check_argument_type Problem: [security]: use-after-free in check_argument_type Solution: Reset function type pointer when freeing the function type list function pointer fp->uf_func_type may point to the same memory, that was allocated for fp->uf_type_list. However, when cleaning up a function definition (e.g. because it was invalid), fp->uf_type_list will be freed, but fp->uf_func_type may still point to the same (now) invalid memory address. So when freeing the fp->uf_type_list, check if fp->func_type points to any of those types and if it does, reset the fp->uf_func_type pointer to the t_func_any (default) type pointer closes: vim/vim#13652 https://github.com/vim/vim/commit/0f28791b215bd4c22ed580839409c2f7d39d8140 Co-authored-by: Christian Brabandt --- test/old/testdir/crash/poc_uaf_check_argument_types | Bin 0 -> 43 bytes test/old/testdir/test_crash.vim | 6 ++++++ 2 files changed, 6 insertions(+) create mode 100644 test/old/testdir/crash/poc_uaf_check_argument_types (limited to 'test/old/testdir') diff --git a/test/old/testdir/crash/poc_uaf_check_argument_types b/test/old/testdir/crash/poc_uaf_check_argument_types new file mode 100644 index 0000000000..83a2e7b0a6 Binary files /dev/null and b/test/old/testdir/crash/poc_uaf_check_argument_types differ diff --git a/test/old/testdir/test_crash.vim b/test/old/testdir/test_crash.vim index 242da8e5db..fd786e5d54 100644 --- a/test/old/testdir/test_crash.vim +++ b/test/old/testdir/test_crash.vim @@ -184,6 +184,12 @@ func Test_crash1_3() call term_sendkeys(buf, args) call TermWait(buf, 150) + let file = 'crash/poc_uaf_check_argument_types' + let cmn_args = "%s -u NONE -i NONE -n -e -s -S %s -c ':qa!'\" + let args = printf(cmn_args, vim, file) + call term_sendkeys(buf, args) + call TermWait(buf, 150) + " clean up exe buf .. "bw!" bw! -- cgit From 6af359ef4cc3c221e0e3102ab2b54cf64d7c9835 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 2 Aug 2024 06:00:02 +0800 Subject: vim-patch:9.1.0647: [security] use-after-free in tagstack_clear_entry Problem: [security] use-after-free in tagstack_clear_entry (Suyue Guo ) Solution: Instead of manually calling vim_free() on each of the tagstack entries, let's use tagstack_clear_entry(), which will also free the stack, but using the VIM_CLEAR macro, which prevents a use-after-free by setting those pointers to NULL This addresses CVE-2024-41957 Github advisory: https://github.com/vim/vim/security/advisories/GHSA-f9cr-gv85-hcr4 https://github.com/vim/vim/commit/8a0bbe7b8aad6f8da28dee218c01bc8a0185a2d5 Co-authored-by: Christian Brabandt --- test/old/testdir/crash/double_free | Bin 0 -> 561 bytes test/old/testdir/test_crash.vim | 6 ++++++ 2 files changed, 6 insertions(+) create mode 100644 test/old/testdir/crash/double_free (limited to 'test/old/testdir') diff --git a/test/old/testdir/crash/double_free b/test/old/testdir/crash/double_free new file mode 100644 index 0000000000..895c4a04b6 Binary files /dev/null and b/test/old/testdir/crash/double_free differ diff --git a/test/old/testdir/test_crash.vim b/test/old/testdir/test_crash.vim index fd786e5d54..29061aa423 100644 --- a/test/old/testdir/test_crash.vim +++ b/test/old/testdir/test_crash.vim @@ -190,6 +190,12 @@ func Test_crash1_3() call term_sendkeys(buf, args) call TermWait(buf, 150) + let file = 'crash/double_free' + let cmn_args = "%s -u NONE -i NONE -n -e -s -S %s -c ':qa!'\" + let args = printf(cmn_args, vim, file) + call term_sendkeys(buf, args) + call TermWait(buf, 50) + " clean up exe buf .. "bw!" bw! -- cgit From b782a37cf58b5ae5e47fd15fb2a5096639c64a23 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 2 Aug 2024 07:52:09 +0800 Subject: vim-patch:9.1.0651: ex: trailing dot is optional for :g and :insert/:append (#29946) Problem: ex: trailing dot is optional for :g and :insert/:append Solution: don't break out early, when the next command is empty. (Mohamed Akram) The terminating period is optional for the last command in a global command list. closes: vim/vim#15407 https://github.com/vim/vim/commit/0214680a8ec5f7f656cb42e5db19243709202ed2 Co-authored-by: Mohamed Akram --- test/old/testdir/test_ex_mode.vim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ex_mode.vim b/test/old/testdir/test_ex_mode.vim index f55ba87a3e..9f3ee2194e 100644 --- a/test/old/testdir/test_ex_mode.vim +++ b/test/old/testdir/test_ex_mode.vim @@ -307,4 +307,13 @@ func Test_insert_after_trailing_bar() bwipe! endfunc +" Test global insert of a newline without terminating period +func Test_global_insert_newline() + new + call setline(1, ['foo']) + call feedkeys("Qg/foo/i\\\n", "xt") + call assert_equal(['', 'foo'], getline(1, '$')) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 48e4589eaded3213956aa9ddbcc0aa6971a974e5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 2 Aug 2024 10:58:10 +0800 Subject: vim-patch:8.2.4416: Vim9: using a script-local function requires using "s:" (#29950) Problem: Vim9: using a script-local function requires using "s:" when setting 'completefunc'. Solution: Do not require "s:" in Vim9 script. (closes vim/vim#9796) https://github.com/vim/vim/commit/1fca5f3e86f08e696058fc7e86dfe41b415a78e6 vim-patch:8.2.4417: using NULL pointer Problem: Using NULL pointer. Solution: Set offset after checking for NULL pointer. https://github.com/vim/vim/commit/e89bfd212b21c227f026e467f882c62cdd6e642d Co-authored-by: Bram Moolenaar --- test/old/testdir/test_ins_complete.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 882e707f63..b90c0013d9 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -1691,6 +1691,23 @@ func Test_completefunc_callback() bw! delfunc s:CompleteFunc3 + " In Vim9 script s: can be omitted + let lines =<< trim END + vim9script + var CompleteFunc4Args = [] + def CompleteFunc4(findstart: bool, base: string): any + add(CompleteFunc4Args, [findstart, base]) + return findstart ? 0 : [] + enddef + set completefunc=CompleteFunc4 + new + setline(1, 'script1') + feedkeys("A\\\", 'x') + assert_equal([[1, ''], [0, 'script1']], CompleteFunc4Args) + bw! + END + call CheckScriptSuccess(lines) + " invalid return value let &completefunc = {a -> 'abc'} call feedkeys("A\\\", 'x') -- cgit From f7fde0173af95925e7324b7d3c09776173dab8a7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 1 Aug 2024 10:13:45 +0800 Subject: vim-patch:9.0.0632: calling a function from an "expr" option has overhead Problem: Calling a function from an "expr" option has too much overhead. Solution: Add call_simple_func() and use it for 'foldexpr' https://github.com/vim/vim/commit/87b4e5c5db9d1cfd6f2e79656e1a6cff3c69d15f Cherry-pick a call_func() change from patch 8.2.1343. Add expr-option-function docs to options.txt. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_fold.vim | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_fold.vim b/test/old/testdir/test_fold.vim index 36f72f5e01..a0eb3afdbb 100644 --- a/test/old/testdir/test_fold.vim +++ b/test/old/testdir/test_fold.vim @@ -386,6 +386,32 @@ func Test_foldexpr_no_interrupt_addsub() set foldmethod& foldexpr& endfunc +" Fold function defined in another script +func Test_foldexpr_compiled() + throw 'Skipped: Vim9 script is N/A' + new + let lines =<< trim END + vim9script + def FoldFunc(): number + return v:lnum + enddef + + set foldmethod=expr + set foldexpr=s:FoldFunc() + END + call writefile(lines, 'XfoldExpr', 'D') + source XfoldExpr + + call setline(1, ['one', 'two', 'three']) + redraw + call assert_equal(1, foldlevel(1)) + call assert_equal(2, foldlevel(2)) + call assert_equal(3, foldlevel(3)) + + bwipe! + set foldmethod& foldexpr& +endfunc + func Check_foldlevels(expected) call assert_equal(a:expected, map(range(1, line('$')), 'foldlevel(v:val)')) endfunc -- cgit From e7f8349a2eec01dda531d93fecb8df920b042d9f Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 2 Aug 2024 20:13:17 +0200 Subject: vim-patch:9.1.0655: filetype: goaccess config file not recognized Problem: filetype: goaccess config file not recognized Solution: detect 'goaccess.conf' as goaccess filetype, also include a basic syntax and ftplugin (Adam Monsen) Add syntax highlighting for GoAccess configuration file. GoAccess is a real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser. GoAccess home page: https://goaccess.io closes: vim/vim#15414 https://github.com/vim/vim/commit/0aa65b48fbe64e18a767b207802483026baecb5d Co-authored-by: Adam Monsen --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index f9da5a914e..7e7a29d9cc 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -301,6 +301,7 @@ func s:GetFilenameChecks() abort \ 'gnash': ['gnashrc', '.gnashrc', 'gnashpluginrc', '.gnashpluginrc'], \ 'gnuplot': ['file.gpi', '.gnuplot', 'file.gnuplot', '.gnuplot_history'], \ 'go': ['file.go'], + \ 'goaccess': ['goaccess.conf'], \ 'gomod': ['go.mod'], \ 'gosum': ['go.sum', 'go.work.sum'], \ 'gowork': ['go.work'], -- cgit From 6967c08840bedfecc54884af815b75ff7ab7af7b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 3 Aug 2024 08:13:20 +0800 Subject: vim-patch:9.1.0648: [security] double-free in dialog_changed() Problem: [security] double-free in dialog_changed() (SuyueGuo) Solution: Only clear pointer b_sfname pointer, if it is different than the b_ffname pointer. Don't try to free b_fname, set it to NULL instead. fixes: vim/vim#15403 Github Advisory: https://github.com/vim/vim/security/advisories/GHSA-46pw-v7qw-xc2f https://github.com/vim/vim/commit/b29f4abcd4b3382fa746edd1d0562b7b48c9de60 Co-authored-by: Christian Brabandt --- test/old/testdir/crash/dialog_changed_uaf | Bin 0 -> 552 bytes test/old/testdir/test_crash.vim | 6 ++++++ 2 files changed, 6 insertions(+) create mode 100644 test/old/testdir/crash/dialog_changed_uaf (limited to 'test/old/testdir') diff --git a/test/old/testdir/crash/dialog_changed_uaf b/test/old/testdir/crash/dialog_changed_uaf new file mode 100644 index 0000000000..e37d18d6da Binary files /dev/null and b/test/old/testdir/crash/dialog_changed_uaf differ diff --git a/test/old/testdir/test_crash.vim b/test/old/testdir/test_crash.vim index 29061aa423..9aef245026 100644 --- a/test/old/testdir/test_crash.vim +++ b/test/old/testdir/test_crash.vim @@ -196,6 +196,12 @@ func Test_crash1_3() call term_sendkeys(buf, args) call TermWait(buf, 50) + let file = 'crash/dialog_changed_uaf' + let cmn_args = "%s -u NONE -i NONE -n -e -s -S %s -c ':qa!'\" + let args = printf(cmn_args, vim, file) + call term_sendkeys(buf, args) + call TermWait(buf, 150) + " clean up exe buf .. "bw!" bw! -- cgit From 28fbba2092adb9659253434605cb94252241f5e0 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 6 Aug 2024 20:49:59 +0800 Subject: vim-patch:9.1.0465: missing filecopy() function (#29989) Problem: missing filecopy() function Solution: implement filecopy() Vim script function (Shougo Matsushita) closes: vim/vim#12346 https://github.com/vim/vim/commit/60c8743ab6c90e402e6ed49d27455ef7e5698abe Co-authored-by: Shougo Matsushita --- test/old/testdir/test_filecopy.vim | 72 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 test/old/testdir/test_filecopy.vim (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filecopy.vim b/test/old/testdir/test_filecopy.vim new file mode 100644 index 0000000000..b526dce7b8 --- /dev/null +++ b/test/old/testdir/test_filecopy.vim @@ -0,0 +1,72 @@ +" Test filecopy() + +source check.vim +source shared.vim + +func Test_copy_file_to_file() + call writefile(['foo'], 'Xcopy1') + + call assert_true(filecopy('Xcopy1', 'Xcopy2')) + + call assert_equal(['foo'], readfile('Xcopy2')) + + " When the destination file already exists, it should not be overwritten. + call writefile(['foo'], 'Xcopy1') + call writefile(['bar'], 'Xcopy2', 'D') + call assert_false(filecopy('Xcopy1', 'Xcopy2')) + call assert_equal(['bar'], readfile('Xcopy2')) + + call delete('Xcopy2') + call delete('Xcopy1') +endfunc + +func Test_copy_symbolic_link() + CheckUnix + + call writefile(['text'], 'Xtestfile', 'D') + silent !ln -s -f Xtestfile Xtestlink + + call assert_true(filecopy('Xtestlink', 'Xtestlink2')) + call assert_equal('link', getftype('Xtestlink2')) + call assert_equal(['text'], readfile('Xtestlink2')) + + " When the destination file already exists, it should not be overwritten. + call assert_false(filecopy('Xtestlink', 'Xtestlink2')) + + call delete('Xtestlink2') + call delete('Xtestlink') + call delete('Xtestfile') +endfunc + +func Test_copy_dir_to_dir() + call mkdir('Xcopydir1') + call writefile(['foo'], 'Xcopydir1/Xfilecopy') + call mkdir('Xcopydir2') + + " Directory copy is not supported + call assert_false(filecopy('Xcopydir1', 'Xcopydir2')) + + call delete('Xcopydir2', 'rf') + call delete('Xcopydir1', 'rf') +endfunc + +func Test_copy_fails() + CheckUnix + + call writefile(['foo'], 'Xfilecopy', 'D') + + " Can't copy into a non-existing directory. + call assert_false(filecopy('Xfilecopy', 'Xdoesnotexist/Xfilecopy')) + + " Can't copy a non-existing file. + call assert_false(filecopy('Xdoesnotexist', 'Xfilecopy2')) + call assert_equal('', glob('Xfilecopy2')) + + " Can't copy to en empty file name. + call assert_false(filecopy('Xfilecopy', '')) + + call assert_fails('call filecopy("Xfilecopy", [])', 'E1174:') + call assert_fails('call filecopy(0z, "Xfilecopy")', 'E1174:') +endfunc + +" vim: shiftwidth=2 sts=2 expandtab -- cgit From 37952bf7b442cac794c4663f2e0123e7d72bc443 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 6 Aug 2024 21:19:12 +0800 Subject: vim-patch:8.2.4838: checking for absolute path is not trivial (#29990) Problem: Checking for absolute path is not trivial. Solution: Add isabsolutepath(). (closes vim/vim#10303) https://github.com/vim/vim/commit/dca1d40cd0f2af0755519e7028378bd3c8fefd31 vim-patch:8a3b805c6c9c Co-authored-by: LemonBoy --- test/old/testdir/test_functions.vim | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 01e9ae3bf2..29bec72f2b 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -3559,6 +3559,24 @@ func Test_builtin_check() unlet bar endfunc +" Test for isabsolutepath() +func Test_isabsolutepath() + call assert_false(isabsolutepath('')) + call assert_false(isabsolutepath('.')) + call assert_false(isabsolutepath('../Foo')) + call assert_false(isabsolutepath('Foo/')) + if has('win32') + call assert_true(isabsolutepath('A:\')) + call assert_true(isabsolutepath('A:\Foo')) + call assert_true(isabsolutepath('A:/Foo')) + call assert_false(isabsolutepath('A:Foo')) + call assert_false(isabsolutepath('\Windows')) + call assert_true(isabsolutepath('\\Server2\Share\Test\Foo.txt')) + else + call assert_true(isabsolutepath('/')) + call assert_true(isabsolutepath('/usr/share/')) + endif +endfunc " Test for virtcol() func Test_virtcol() -- cgit From 9307a53c7bc30f9d17b6ab97e90d8a1b5fc313b2 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 7 Aug 2024 06:53:05 +0800 Subject: vim-patch:9.1.0661: the zip plugin is not tested. (#29993) Problem: the zip plugin is not tested. Solution: include tests (Damien) closes: vim/vim#15411 https://github.com/vim/vim/commit/d7af21e746f3992c650caf6b76465880b96302b4 Co-authored-by: Damien <141588647+xrandomname@users.noreply.github.com> --- test/old/testdir/samples/test.zip | Bin 0 -> 464 bytes test/old/testdir/test_zip_plugin.vim | 139 +++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 test/old/testdir/samples/test.zip create mode 100644 test/old/testdir/test_zip_plugin.vim (limited to 'test/old/testdir') diff --git a/test/old/testdir/samples/test.zip b/test/old/testdir/samples/test.zip new file mode 100644 index 0000000000..6d34ac6992 Binary files /dev/null and b/test/old/testdir/samples/test.zip differ diff --git a/test/old/testdir/test_zip_plugin.vim b/test/old/testdir/test_zip_plugin.vim new file mode 100644 index 0000000000..741e4ed91f --- /dev/null +++ b/test/old/testdir/test_zip_plugin.vim @@ -0,0 +1,139 @@ +so check.vim + +CheckExecutable unzip + +if 0 " Find uncovered line + profile start zip_profile + profile! file */zip*.vim +endif + +runtime plugin/zipPlugin.vim + +func Test_zip_basic() + let _sl = &shellslash + set noshellslash + + "## get our zip file + if !filecopy("samples/test.zip", "X.zip") + call assert_report("Can't copy samples/test.zip") + return + endif + defer delete("X.zip") + + e X.zip + + "## Check header + call assert_match('^" zip\.vim version v\d\+', getline(1)) + call assert_match('^" Browsing zipfile .*/X.zip', getline(2)) + call assert_match('^" Select a file with cursor and press ENTER', getline(3)) + call assert_match('^$', getline(4)) + + "## Check files listing + call assert_equal(["Xzip/", "Xzip/dir/", "Xzip/file.txt"], getline(5, 7)) + + "## Check ENTER on header + :1 + exe ":normal \" + call assert_equal("X.zip", @%) + + "## Check ENTER on directory + :1|:/^$//dir/ + call assert_match('Please specify a file, not a directory', + \ execute("normal \")) + + "## Check ENTER on file + :1|:/^$//file/ + exe ":normal \" + call assert_match('zipfile://.*/X.zip::Xzip/file.txt', @%) + call assert_equal('one', getline(1)) + + "## Check editing file + if executable("zip") + s/one/two/ + call assert_equal("two", getline(1)) + w + bw|bw + e X.zip + + :1|:/^$//file/ + exe "normal \" + call assert_equal("two", getline(1)) + endif + + only + e X.zip + + "## Check extracting file + :1|:/^$//file/ + normal x + call assert_true(filereadable("Xzip/file.txt")) + call delete("Xzip", "rf") + + "## Check extracting directory + :1|:/^$//dir/ + call assert_match('Please specify a file, not a directory', execute("normal x")) + call assert_equal("X.zip", @%) + + "## Check "x" on header + :1 + normal x + call assert_equal("X.zip", @%) + bw + + "## Check opening zip when "unzip" program is missing + let save_zip_unzipcmd = g:zip_unzipcmd + let g:zip_unzipcmd = "/" + call assert_match('unzip not available on your system', execute("e X.zip")) + + "## Check when "unzip" don't work + if executable("false") + let g:zip_unzipcmd = "false" + call assert_match('X\.zip is not a zip file', execute("e X.zip")) + endif + bw + + let g:zip_unzipcmd = save_zip_unzipcmd + e X.zip + + "## Check opening file when "unzip" is missing + let g:zip_unzipcmd = "/" + call assert_match('sorry, your system doesn''t appear to have the / program', + \ execute("normal \")) + + bw|bw + let g:zip_unzipcmd = save_zip_unzipcmd + e X.zip + + "## Check :write when "zip" program is missing + :1|:/^$//file/ + exe "normal \Goanother\" + let save_zip_zipcmd = g:zip_zipcmd + let g:zip_zipcmd = "/" + call assert_match('sorry, your system doesn''t appear to have the / program', + \ execute("write")) + + "## Check when "zip" report failure + if executable("false") + let g:zip_zipcmd = "false" + call assert_match('sorry, unable to update .*/X.zip with Xzip/file.txt', + \ execute("write")) + endif + bw!|bw + + let g:zip_zipcmd = save_zip_zipcmd + + "## Check opening an no zipfile + call writefile(["qsdf"], "Xcorupt.zip", "D") + e! Xcorupt.zip + call assert_equal("qsdf", getline(1)) + + bw + + "## Check no existing zipfile + call assert_match('File not readable', execute("e Xnot_exists.zip")) + + bw + + let &shellslash = _sl + +endfunc -- cgit From 1937870114f5dd824a9bb61ee8dfd3be2acc5439 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 7 Aug 2024 07:07:49 +0800 Subject: vim-patch:9.1.0663: tests: zip test still resets 'shellslash' option Problem: tests: zip test still resets 'shellslash' option Solution: Remove resetting the 'shellslash' option, the zip plugin should now be able to handle this options closes: vim/vim#15434 https://github.com/vim/vim/commit/91efcd115e700725b9ebded0f5d7bc0d3fa98d9d Co-authored-by: Christian Brabandt --- test/old/testdir/test_zip_plugin.vim | 4 ---- 1 file changed, 4 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_zip_plugin.vim b/test/old/testdir/test_zip_plugin.vim index 741e4ed91f..b214516e05 100644 --- a/test/old/testdir/test_zip_plugin.vim +++ b/test/old/testdir/test_zip_plugin.vim @@ -10,8 +10,6 @@ endif runtime plugin/zipPlugin.vim func Test_zip_basic() - let _sl = &shellslash - set noshellslash "## get our zip file if !filecopy("samples/test.zip", "X.zip") @@ -134,6 +132,4 @@ func Test_zip_basic() bw - let &shellslash = _sl - endfunc -- cgit From 92186be428e84798ac6fa6c69ae575187a0d3da8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 8 Aug 2024 14:51:29 +0800 Subject: vim-patch:8.2.3476: renaming a buffer on startup may cause using freed memory Problem: Renaming a buffer on startup may cause using freed memory. Solution: Check if the buffer is used in a window. (closes vim/vim#8955) https://github.com/vim/vim/commit/d3710cf01ef6ab1b2f233866ff01dab76686f642 Cherry-pick Test_echo_true_in_cmd() from Vim. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_startup.vim | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_startup.vim b/test/old/testdir/test_startup.vim index c80d98925a..c46b4002c2 100644 --- a/test/old/testdir/test_startup.vim +++ b/test/old/testdir/test_startup.vim @@ -1276,4 +1276,34 @@ func Test_write_in_vimrc() call delete('Xvimrc') endfunc +func Test_echo_true_in_cmd() + CheckNotGui + + let lines =<< trim END + echo v:true + call writefile(['done'], 'Xresult') + quit + END + call writefile(lines, 'Xscript') + if RunVim([], [], '--cmd "source Xscript"') + call assert_equal(['done'], readfile('Xresult')) + endif + call delete('Xscript') + call delete('Xresult') +endfunc + +func Test_rename_buffer_on_startup() + let lines =<< trim END + call writefile(['done'], 'Xresult') + qa! + END + call writefile(lines, 'Xscript') + if RunVim([], [], "--clean -e -s --cmd 'file x|new|file x' --cmd 'so Xscript'") + call assert_equal(['done'], readfile('Xresult')) + endif + call delete('Xscript') + call delete('Xresult') +endfunc + + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 94cc29392776df268e87e2344cf1b3bc466066da Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 8 Aug 2024 14:55:05 +0800 Subject: vim-patch:8.2.3477: startup test fails on MS-Windows Problem: Startup test fails on MS-Windows. Solution: Skip the test if not on Unix. https://github.com/vim/vim/commit/6d197987745427801a2195836ef89e48537afbeb Co-authored-by: Bram Moolenaar --- test/old/testdir/test_startup.vim | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_startup.vim b/test/old/testdir/test_startup.vim index c46b4002c2..ed4c4526f7 100644 --- a/test/old/testdir/test_startup.vim +++ b/test/old/testdir/test_startup.vim @@ -1293,6 +1293,8 @@ func Test_echo_true_in_cmd() endfunc func Test_rename_buffer_on_startup() + CheckUnix + let lines =<< trim END call writefile(['done'], 'Xresult') qa! -- cgit From 336ab2682e08b95c51b8cbafcf9697b5a42026d1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 9 Aug 2024 06:57:17 +0800 Subject: vim-patch:8.2.4860: MS-Windows: always uses current directory for executables Problem: MS-Windows: always uses current directory for executables. Solution: Check the NoDefaultCurrentDirectoryInExePath environment variable. (Yasuhiro Matsumoto, closes vim/vim#10341) https://github.com/vim/vim/commit/05cf63e9bdca1ac070df3e7d9c6dfc45e68ac916 Omit doc change: override in later doc update. Co-authored-by: Yasuhiro Matsumoto --- test/old/testdir/test_functions.vim | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 29bec72f2b..df4c6b1556 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -3578,6 +3578,24 @@ func Test_isabsolutepath() endif endfunc +" Test for exepath() +func Test_exepath() + if has('win32') + call assert_notequal(exepath('cmd'), '') + + let oldNoDefaultCurrentDirectoryInExePath = $NoDefaultCurrentDirectoryInExePath + call writefile(['@echo off', 'echo Evil'], 'vim-test-evil.bat') + let $NoDefaultCurrentDirectoryInExePath = '' + call assert_notequal(exepath("vim-test-evil.bat"), '') + let $NoDefaultCurrentDirectoryInExePath = '1' + call assert_equal(exepath("vim-test-evil.bat"), '') + let $NoDefaultCurrentDirectoryInExePath = oldNoDefaultCurrentDirectoryInExePath + call delete('vim-test-evil.bat') + else + call assert_notequal(exepath('sh'), '') + endif +endfunc + " Test for virtcol() func Test_virtcol() new -- cgit From 4e8efe002e976de1a22dcce6a1e800aeb6acad70 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 10 Aug 2024 06:35:51 +0800 Subject: vim-patch:9.1.0666: assert_equal() doesn't show multibyte string correctly (#30018) Problem: assert_equal() doesn't show multibyte string correctly Solution: Properly advance over a multibyte char. (zeertzjq) closes: vim/vim#15456 https://github.com/vim/vim/commit/9c4b2462bb498f44044616f7309d111d12170369 --- test/old/testdir/test_assert.vim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_assert.vim b/test/old/testdir/test_assert.vim index bc79ef9296..fa63af687d 100644 --- a/test/old/testdir/test_assert.vim +++ b/test/old/testdir/test_assert.vim @@ -48,10 +48,19 @@ func Test_assert_equal() call assert_match("Expected 'bar' but got 'foo'", v:errors[0]) call remove(v:errors, 0) + let s = 'αβγ' + call assert_equal(1, assert_equal('δεζ', s)) + call assert_match("Expected 'δεζ' but got 'αβγ'", v:errors[0]) + call remove(v:errors, 0) + call assert_equal('XxxxxxxxxxxxxxxxxxxxxxX', 'XyyyyyyyyyyyyyyyyyyyyyyyyyX') call assert_match("Expected 'X\\\\\\[x occurs 21 times]X' but got 'X\\\\\\[y occurs 25 times]X'", v:errors[0]) call remove(v:errors, 0) + call assert_equal('ΩωωωωωωωωωωωωωωωωωωωωωΩ', 'ΩψψψψψψψψψψψψψψψψψψψψψψψψψΩ') + call assert_match("Expected 'Ω\\\\\\[ω occurs 21 times]Ω' but got 'Ω\\\\\\[ψ occurs 25 times]Ω'", v:errors[0]) + call remove(v:errors, 0) + " special characters are escaped call assert_equal("\b\e\f\n\t\r\\\x01\x7f", 'x') call assert_match('Expected ''\\b\\e\\f\\n\\t\\r\\\\\\x01\\x7f'' but got ''x''', v:errors[0]) -- cgit From 0ec43cb4b56673d661d6bd1e39836d0a891be5cd Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 10 Aug 2024 16:05:30 +0800 Subject: vim-patch:9.1.0667: Some other options reset curswant unnecessarily when set (#30020) Problem: Some other options reset curswant unnecessarily when set. (Andrew Haust) Solution: Don't reset curswant when setting 'comments', 'commentstring' or 'define' (zeertzjq) fixes: vim/vim#15462 closes: vim/vim#15467 https://github.com/vim/vim/commit/b026a293b1e9d7a30f7717e256fe5f7f1dfa20d7 --- test/old/testdir/test_goto.vim | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_goto.vim b/test/old/testdir/test_goto.vim index 8813bcbacd..b6a6695d17 100644 --- a/test/old/testdir/test_goto.vim +++ b/test/old/testdir/test_goto.vim @@ -322,6 +322,7 @@ func Test_set_options_keep_col() normal j set invhlsearch spell spelllang=en,cjk spelloptions=camel textwidth=80 set cursorline cursorcolumn cursorlineopt=line colorcolumn=+1 winfixbuf + set comments=:# commentstring=#%s define=function set background=dark set background=light normal k @@ -329,6 +330,7 @@ func Test_set_options_keep_col() bwipe! set hlsearch& spell& spelllang& spelloptions& textwidth& set cursorline& cursorcolumn& cursorlineopt& colorcolumn& winfixbuf& + set comments& commentstring& define& set background& endfunc -- cgit From 37d97e771e9140746629bc3e67ad2dfbd39888c5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 12 Aug 2024 06:52:31 +0800 Subject: vim-patch:9.1.0672: marker folds may get corrupted on undo (#30026) Problem: marker folds may get corrupted on undo (Yousef Mohammed) Solution: when adjusting folds, make sure that line1 is the lower limit and line2 is the upper line limit. In particular, line2 should not be able to get smaller than line1. fixes: vim/vim#15455 closes: vim/vim#15466 https://github.com/vim/vim/commit/8d02e5cf961b06da5bc490ac5972bcbc252c4793 Co-authored-by: Christian Brabandt --- test/old/testdir/test_fold.vim | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_fold.vim b/test/old/testdir/test_fold.vim index a0eb3afdbb..6569e032f6 100644 --- a/test/old/testdir/test_fold.vim +++ b/test/old/testdir/test_fold.vim @@ -1756,4 +1756,25 @@ func Test_cursor_down_fold_eob() bwipe! endfunc +" issue: #15455 +func Test_cursor_fold_marker_undo() + new + call setline(1, ['{{{', '', 'This is a Line', '', 'This is a Line', '', '}}}']) + let &ul=&ul + setl foldmethod=marker + call cursor(2, 1) + norm! zo1vjdu + call assert_equal(1, foldlevel('.')) + bwipe! + new + call setline(1, ['', '{{{', '', 'This is a Line', '', 'This is a Line', '', '}}}']) + let &ul=&ul + setl foldmethod=marker + call cursor(3, 1) + norm! zo + norm! vjdu + call assert_equal(1, foldlevel('.')) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From b3d291c5656085189e1ba65357119f16e2f5e9b0 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 16 Aug 2024 09:00:50 +0800 Subject: vim-patch:9.1.0678: [security]: use-after-free in alist_add() Problem: [security]: use-after-free in alist_add() (SuyueGuo) Solution: Lock the current window, so that the reference to the argument list remains valid. This fixes CVE-2024-43374 https://github.com/vim/vim/commit/0a6e57b09bc8c76691b367a5babfb79b31b770e8 Co-authored-by: Christian Brabandt --- test/old/testdir/test_arglist.vim | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_arglist.vim b/test/old/testdir/test_arglist.vim index ebda332562..952b121aed 100644 --- a/test/old/testdir/test_arglist.vim +++ b/test/old/testdir/test_arglist.vim @@ -360,6 +360,7 @@ func Test_argv() call assert_equal('', argv(1, 100)) call assert_equal([], argv(-1, 100)) call assert_equal('', argv(10, -1)) + %argdelete endfunc " Test for the :argedit command @@ -744,4 +745,26 @@ func Test_all_command() %bw! endfunc +" Test for deleting buffer when creating an arglist. This was accessing freed +" memory +func Test_crash_arglist_uaf() + "%argdelete + new one + au BufAdd XUAFlocal :bw + "call assert_fails(':arglocal XUAFlocal', 'E163:') + arglocal XUAFlocal + au! BufAdd + bw! XUAFlocal + + au BufAdd XUAFlocal2 :bw + new two + new three + arglocal + argadd XUAFlocal2 Xfoobar + bw! XUAFlocal2 + bw! two + + au! BufAdd +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From a25dbeee10756a8f457d4632e8fda0c1cb509d61 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 16 Aug 2024 08:32:53 +0800 Subject: vim-patch:9.1.0677: :keepp does not retain the substitute pattern Problem: :keeppatterns does not retain the substitute pattern for a :s command Solution: preserve the last substitute pattern when used with the :keeppatterns command modifier (Gregory Anders) closes: vim/vim#15497 https://github.com/vim/vim/commit/3b59be4ed8a145d3188934f1a5cd85432bd2433d Co-authored-by: Gregory Anders --- test/old/testdir/test_substitute.vim | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_substitute.vim b/test/old/testdir/test_substitute.vim index f0a25b2804..90c46abe8b 100644 --- a/test/old/testdir/test_substitute.vim +++ b/test/old/testdir/test_substitute.vim @@ -806,7 +806,7 @@ func Test_replace_keeppatterns() a foobar -substitute foo asdf +substitute foo asdf foo one two . @@ -815,21 +815,26 @@ one two /^substitute s/foo/bar/ call assert_equal('foo', @/) - call assert_equal('substitute bar asdf', getline('.')) + call assert_equal('substitute bar asdf foo', getline('.')) /^substitute keeppatterns s/asdf/xyz/ call assert_equal('^substitute', @/) - call assert_equal('substitute bar xyz', getline('.')) + call assert_equal('substitute bar xyz foo', getline('.')) + + /^substitute + & + call assert_equal('^substitute', @/) + call assert_equal('substitute bar xyz bar', getline('.')) exe "normal /bar /e\" call assert_equal(15, col('.')) normal - keeppatterns /xyz call assert_equal('bar ', @/) - call assert_equal('substitute bar xyz', getline('.')) + call assert_equal('substitute bar xyz bar', getline('.')) exe "normal 0dn" - call assert_equal('xyz', getline('.')) + call assert_equal('xyz bar', getline('.')) close! endfunc -- cgit From 6f7bb02e7f7b8ff8fe4d67a433cd3a2250df7a11 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 21 Aug 2024 07:35:27 +0800 Subject: vim-patch:9.1.0686: zip-plugin has problems with special characters (#30108) Problem: zip-plugin has problems with special characters (user202729) Solution: escape '*?[\' on Unix and handle those chars a bit differently on MS-Windows, add a test, check before overwriting files runtime(zip): small fixes for zip plugin This does the following: - verify the unzip plugin is executable when loading the autoload plugin - handle extracting file names with '[*?\' in its name correctly by escaping those characters for the unzip command (and handle those characters a bit differently on MS-Windows, since the quoting is different) - verify, that the extract plugin is not overwriting a file (could cause a hang, because unzip asking for confirmation) - add a test zip file which contains those special file names fixes: vim/vim#15505 closes: vim/vim#15519 https://github.com/vim/vim/commit/7790ea0c680a9f951a86066e5940ec16b2333c9a Co-authored-by: Christian Brabandt --- test/old/testdir/samples/testa.zip | Bin 0 -> 1236 bytes test/old/testdir/test_zip_plugin.vim | 104 ++++++++++++++++++++++++++++++++++- 2 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 test/old/testdir/samples/testa.zip (limited to 'test/old/testdir') diff --git a/test/old/testdir/samples/testa.zip b/test/old/testdir/samples/testa.zip new file mode 100644 index 0000000000..10b0346e76 Binary files /dev/null and b/test/old/testdir/samples/testa.zip differ diff --git a/test/old/testdir/test_zip_plugin.vim b/test/old/testdir/test_zip_plugin.vim index b214516e05..a817d8371e 100644 --- a/test/old/testdir/test_zip_plugin.vim +++ b/test/old/testdir/test_zip_plugin.vim @@ -40,7 +40,8 @@ func Test_zip_basic() \ execute("normal \")) "## Check ENTER on file - :1|:/^$//file/ + :1 + call search('file.txt') exe ":normal \" call assert_match('zipfile://.*/X.zip::Xzip/file.txt', @%) call assert_equal('one', getline(1)) @@ -65,6 +66,10 @@ func Test_zip_basic() :1|:/^$//file/ normal x call assert_true(filereadable("Xzip/file.txt")) + + "## Check not overwriting existing file + call assert_match(' .* not overwriting!', execute("normal x")) + call delete("Xzip", "rf") "## Check extracting directory @@ -131,5 +136,102 @@ func Test_zip_basic() call assert_match('File not readable', execute("e Xnot_exists.zip")) bw +endfunc + +func Test_zip_glob_fname() + CheckNotMSWindows + " does not work on Windows, why? + + "## copy sample zip file + if !filecopy("samples/testa.zip", "X.zip") + call assert_report("Can't copy samples/testa.zip") + return + endif + defer delete("X.zip") + defer delete('zipglob', 'rf') + + e X.zip + + "## 1) Check extracting strange files + :1 + let fname = 'a[a].txt' + call search('\V' .. fname) + normal x + call assert_true(filereadable('zipglob/' .. fname)) + call delete('zipglob', 'rf') + + :1 + let fname = 'a*.txt' + call search('\V' .. fname) + normal x + call assert_true(filereadable('zipglob/' .. fname)) + call delete('zipglob', 'rf') + + :1 + let fname = 'a?.txt' + call search('\V' .. fname) + normal x + call assert_true(filereadable('zipglob/' .. fname)) + call delete('zipglob', 'rf') + + :1 + let fname = 'a\.txt' + call search('\V' .. escape(fname, '\\')) + normal x + call assert_true(filereadable('zipglob/' .. fname)) + call delete('zipglob', 'rf') + + :1 + let fname = 'a\\.txt' + call search('\V' .. escape(fname, '\\')) + normal x + call assert_true(filereadable('zipglob/' .. fname)) + call delete('zipglob', 'rf') + + "## 2) Check entering strange file names + :1 + let fname = 'a[a].txt' + call search('\V' .. fname) + exe ":normal \" + call assert_match('zipfile://.*/X.zip::zipglob/a\[a\].txt', @%) + call assert_equal('a test file with []', getline(1)) + bw + + e X.zip + :1 + let fname = 'a*.txt' + call search('\V' .. fname) + exe ":normal \" + call assert_match('zipfile://.*/X.zip::zipglob/a\*.txt', @%) + call assert_equal('a test file with a*', getline(1)) + bw + + e X.zip + :1 + let fname = 'a?.txt' + call search('\V' .. fname) + exe ":normal \" + call assert_match('zipfile://.*/X.zip::zipglob/a?.txt', @%) + call assert_equal('a test file with a?', getline(1)) + bw + + e X.zip + :1 + let fname = 'a\.txt' + call search('\V' .. escape(fname, '\\')) + exe ":normal \" + call assert_match('zipfile://.*/X.zip::zipglob/a\\.txt', @%) + call assert_equal('a test file with a\', getline(1)) + bw + e X.zip + :1 + let fname = 'a\\.txt' + call search('\V' .. escape(fname, '\\')) + exe ":normal \" + call assert_match('zipfile://.*/X.zip::zipglob/a\\\\.txt', @%) + call assert_equal('a test file with a double \', getline(1)) + bw + + bw endfunc -- cgit From 362389eb1552abd60df393e38c1fb23b12dafe1d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 22 Aug 2024 05:30:21 +0800 Subject: vim-patch:9.1.0683: mode() returns wrong value with mapping (#30109) Problem: mode() returns wrong value with mapping Solution: Change decision priority of VIsual_active and move visual mode a bit further down (kuuote) closes: vim/vim#15533 https://github.com/vim/vim/commit/0fd1cb1b1fc90b68cb37f71e65289eadac3588a6 Co-authored-by: kuuote --- test/old/testdir/test_functions.vim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index df4c6b1556..7047a62017 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -810,6 +810,10 @@ func Test_mode() call feedkeys("gQ\\vi\", 'xt') call assert_equal("c-cvr", g:current_modes) + " Commandline mode in Visual mode should return "c-c", never "v-v". + call feedkeys("v\call input('')\\\\", 'xt') + call assert_equal("c-c", g:current_modes) + " Executing commands in Vim Ex mode should return "cv", never "cvr", " as Cmdline editing has already ended. call feedkeys("gQcall Save_mode()\vi\", 'xt') -- cgit From bb4b6b427c1952b4a9b72f406b913ec59f0d4d22 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 24 Aug 2024 08:38:05 +0800 Subject: vim-patch:9.1.0690: cannot set special highlight kind in popupmenu (#30128) Problem: cannot set special highlight kind in popupmenu Solution: add kind_hlgroup item to complete function (glepnir) closes: vim/vim#15561 https://github.com/vim/vim/commit/38f99a1f0d61e9bde3f4a3d0cbe2d06185c4a57f Co-authored-by: glepnir --- test/old/testdir/test_popup.vim | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 5e234a397b..2a038d7da4 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1550,4 +1550,37 @@ func Test_pum_user_hl_group() call StopVimInTerminal(buf) endfunc +func Test_pum_user_kind_hlgroup() + CheckScreendump + let lines =<< trim END + func CompleteFunc( findstart, base ) + if a:findstart + return 0 + endif + return { + \ 'words': [ + \ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'variable', 'kind_hlgroup': 'KindVar', 'hl_group': 'StrikeFake' }, + \ { 'word': 'aword2', 'menu': 'extra text 2', 'kind': 'function', 'kind_hlgroup': 'KindFunc' }, + \ { 'word': '你好', 'menu': 'extra text 3', 'kind': 'class', 'kind_hlgroup': 'KindClass' }, + \]} + endfunc + set completeopt=menu + set completefunc=CompleteFunc + + hi StrikeFake ctermfg=9 + hi KindVar ctermfg=yellow + hi KindFunc ctermfg=blue + hi KindClass ctermfg=green + END + call writefile(lines, 'Xscript', 'D') + let buf = RunVimInTerminal('-S Xscript', {}) + + call TermWait(buf) + call term_sendkeys(buf, "S\\") + call VerifyScreenDump(buf, 'Test_pum_highlights_16', {}) + call term_sendkeys(buf, "\\") + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 91ce0c3ddda7659de9adc85601d6a7d6cf05f681 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 24 Aug 2024 18:19:24 +0800 Subject: vim-patch:9.1.0692: Wrong patlen value in ex_substitute() (#30131) Problem: Wrong patlen value in ex_substitute() (after 9.1.0426). Solution: Compute patlen after finding end separator. (zeertzjq) Add a more explicit test. The test already passes as the only case where a overlarge patlen value matters was fixed by patch 9.1.0689. closes: vim/vim#15565 https://github.com/vim/vim/commit/d1c8d2de4b9fa44b3d2b39b7ed8b92846c5502b7 --- test/old/testdir/test_search.vim | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_search.vim b/test/old/testdir/test_search.vim index 077a7d03a3..b62c2b2e5f 100644 --- a/test/old/testdir/test_search.vim +++ b/test/old/testdir/test_search.vim @@ -1668,6 +1668,37 @@ func Test_search_with_no_last_pat() call delete('Xresult') endfunc +" Test for using the last substitute pattern without last search pattern. +func Test_search_with_last_substitute_pat() + let lines =<< trim [SCRIPT] + new + set shortmess+=S + call setline(1, repeat(['foofoo'], 3)) + %s/foo/bar/ + call assert_equal(repeat(['barfoo'], 3), getline(1, '$')) + + call cursor(1, 1) + call assert_equal("/foo", execute('call feedkeys("/\r", "tx")', '')->trim()) + call assert_equal([0, 1, 4, 0], getpos('.')) + + if has('rightleft') + set rightleft rightleftcmd=search + call cursor(1, 1) + call assert_equal("oof/", execute('call feedkeys("/\r", "tx")', '')->trim()) + call assert_equal([0, 1, 4, 0], getpos('.')) + endif + + call writefile(v:errors, 'Xresult') + qall! + [SCRIPT] + call writefile(lines, 'Xscript', 'D') + + if RunVim([], [], '--clean -S Xscript') + call assert_equal([], readfile('Xresult')) + endif + call delete('Xresult') +endfunc + " Test for using tilde (~) atom in search. This should use the last used " substitute pattern func Test_search_tilde_pat() -- cgit From cf44121f7fb6f55a22e644a1e5e1f1dc6b90c27a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 25 Aug 2024 06:07:43 +0800 Subject: vim-patch:9.1.0694: matchparen is slow on a long line (#30134) Problem: The matchparen plugin is slow on a long line. Solution: Don't use a regexp to get char at and before cursor. (zeertzjq) Example: ```vim call setline(1, repeat(' foobar', 100000)) runtime plugin/matchparen.vim normal! $hhhhhhhh ``` closes: vim/vim#15568 https://github.com/vim/vim/commit/81e7513c86459c40676bd983f73c2722096d67a9 --- test/old/testdir/test_matchparen.vim | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_matchparen.vim b/test/old/testdir/test_matchparen.vim index ab425b046a..7d80e43046 100644 --- a/test/old/testdir/test_matchparen.vim +++ b/test/old/testdir/test_matchparen.vim @@ -108,5 +108,35 @@ func Test_matchparen_pum_clear() call StopVimInTerminal(buf) endfunc +" Test that matchparen works with multibyte chars in 'matchpairs' +func Test_matchparen_mbyte() + CheckScreendump + + let lines =<< trim END + source $VIMRUNTIME/plugin/matchparen.vim + call setline(1, ['aaaaaaaa(', 'bbbb)cc']) + set matchpairs+=(:) + END + + call writefile(lines, 'XmatchparenMbyte', 'D') + let buf = RunVimInTerminal('-S XmatchparenMbyte', #{rows: 10}) + call VerifyScreenDump(buf, 'Test_matchparen_mbyte_1', {}) + call term_sendkeys(buf, "$") + call VerifyScreenDump(buf, 'Test_matchparen_mbyte_2', {}) + call term_sendkeys(buf, "j") + call VerifyScreenDump(buf, 'Test_matchparen_mbyte_3', {}) + call term_sendkeys(buf, "2h") + call VerifyScreenDump(buf, 'Test_matchparen_mbyte_4', {}) + call term_sendkeys(buf, "0") + call VerifyScreenDump(buf, 'Test_matchparen_mbyte_5', {}) + call term_sendkeys(buf, "kA") + call VerifyScreenDump(buf, 'Test_matchparen_mbyte_6', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_matchparen_mbyte_7', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_matchparen_mbyte_8', {}) + + call StopVimInTerminal(buf) +endfunc " vim: shiftwidth=2 sts=2 expandtab -- cgit From 0346666f717576d31be411cd59b07c81eff18f95 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 29 Aug 2024 06:24:40 +0800 Subject: vim-patch:9.1.0699: "dvgo" is not always an inclusive motion (#30173) Problem: "dvgo" is not always an inclusive motion (Iain King-Speir) Solution: initialize the inclusive flag to false fixes: vim/vim#15580 closes: vim/vim#15582 https://github.com/vim/vim/commit/f8702aeb8ff85554d909901ae45b50c3d532bf70 Co-authored-by: Christian Brabandt --- test/old/testdir/test_normal.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index 6ebdfb1604..8088b1fc57 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -4291,4 +4291,17 @@ func Test_scroll_longline_no_loop() exe "normal! \" bwipe! endfunc + +" Test for go command +func Test_normal_go() + new + call setline(1, ['one two three four']) + call cursor(1, 5) + norm! dvgo + call assert_equal('wo three four', getline(1)) + norm! ... + call assert_equal('three four', getline(1)) + + bwipe! +endfunc " vim: shiftwidth=2 sts=2 expandtab nofoldenable -- cgit From cfdf68a7acde16597fbd896674af68c42361102c Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 8 Aug 2024 10:42:08 +0200 Subject: feat(mbyte): support extended grapheme clusters including more emoji Use the grapheme break algorithm from utf8proc to support grapheme clusters from recent unicode versions. Handle variant selector VS16 turning some codepoints into double-width emoji. This means we need to use ptr2cells rather than char2cells when possible. --- test/old/testdir/test_functions.vim | 2 +- test/old/testdir/test_normal.vim | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 7047a62017..ffe7f3fb39 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -3663,7 +3663,7 @@ func Test_string_reverse() call assert_equal('', reverse(v:_null_string)) for [s1, s2] in [['', ''], ['a', 'a'], ['ab', 'ba'], ['abc', 'cba'], \ ['abcd', 'dcba'], ['«-«-»-»', '»-»-«-«'], - \ ['🇦', '🇦'], ['🇦🇧', '🇧🇦'], ['🇦🇧🇨', '🇨🇧🇦'], + \ ['🇦', '🇦'], ['🇦🇧', '🇦🇧'], ['🇦🇧🇨', '🇨🇦🇧'], \ ['🇦«🇧-🇨»🇩', '🇩»🇨-🇧«🇦']] call assert_equal(s2, reverse(s1)) endfor diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index 8088b1fc57..3ebc9a69a4 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -3897,9 +3897,9 @@ func Test_normal_count_after_operator() bw! endfunc -func Test_normal_gj_on_extra_wide_char() +func Test_normal_gj_on_6_cell_wide_unprintable_char() new | 25vsp - let text='1 foooooooo ar e ins‍zwe1 foooooooo ins‍zwei' . + let text='1 foooooooo ar e ins​zwe1 foooooooo ins​zwei' . \ ' i drei vier fünf sechs sieben acht un zehn elf zwöfl' . \ ' dreizehn v ierzehn fünfzehn' put =text -- cgit From a6c4487e8bfc8dc527ed64651515963e46ebeee8 Mon Sep 17 00:00:00 2001 From: glepnir Date: Sat, 31 Aug 2024 17:10:05 +0800 Subject: vim-patch:9.1.0684: completion is inserted on Enter with "noselect" (#30111) Problem: completion is inserted on Enter with "noselect" (Carman Fu) Solution: check noselect before update compl_shown_match (glepnir) fixes: vim/vim#15526 closes: vim/vim#15530 https://github.com/vim/vim/commit/753794bae8a9401903b82e5c5d1f35a106aa912a --- test/old/testdir/test_ins_complete.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index b90c0013d9..48319f5017 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2664,6 +2664,13 @@ func Test_complete_fuzzy_match() call feedkeys("A\\\0", 'tx!') call assert_equal('hello help hero h', getline('.')) + " issue #15526 + set completeopt=fuzzy,menuone,menu,noselect + call setline(1, ['Text', 'ToText', '']) + call cursor(2, 1) + call feedkeys("STe\\x\\0", 'tx!') + call assert_equal('Tex', getline('.')) + " clean up set omnifunc= bw! -- cgit From 97f8d1de1cfaebd67bc994401da38b003b64b6df Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Sun, 1 Sep 2024 14:19:19 +0200 Subject: vim-patch:9.1.0708: Recursive window update does not account for reset skipcol (#30217) Problem: Window is updated with potentially invalid skipcol in recursive window update path. I.e. cursor outside of visible range in large line that does not fit. Solution: Make sure it is valid (Luuk van Baal). https://github.com/vim/vim/commit/3d5065fc7553c8de3d0555c3085165bdd724663b --- test/old/testdir/test_scroll_opt.vim | 2 -- 1 file changed, 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 02e1cc71e4..5bf071903b 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -1165,7 +1165,6 @@ func Test_smooth_long_scrolloff() END call writefile(lines, 'XSmoothLongScrolloff', 'D') let buf = RunVimInTerminal('-u NONE -S XSmoothLongScrolloff', #{rows: 8, cols: 40}) - "FIXME: empty screen due to reset_skipcol()/curs_columns() shenanigans call term_sendkeys(buf, ":norm j721|\") call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_1', {}) @@ -1185,7 +1184,6 @@ func Test_smooth_long_scrolloff() call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_6', {}) call term_sendkeys(buf, "gk") - "FIXME: empty screen due to reset_skipcol()/curs_columns() shenanigans call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_7', {}) call StopVimInTerminal(buf) -- cgit From 7b7c95dac97d6ea4f10855cc198dce650a796c20 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 4 Sep 2024 06:35:26 +0800 Subject: vim-patch:9.1.0713: Newline causes E749 in Ex mode (#30254) Problem: Newline causes E749 in Ex mode (after 9.1.0573). Solution: Don't execute empty command followed by a newline. closes: vim/vim#15614 https://github.com/vim/vim/commit/2432b4a75321a1a9ac0f9b326c7e46d38bdb71bb Cherry-pick code change from patch 8.2.3405. --- test/old/testdir/test_ex_mode.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ex_mode.vim b/test/old/testdir/test_ex_mode.vim index 9f3ee2194e..32b01fef9e 100644 --- a/test/old/testdir/test_ex_mode.vim +++ b/test/old/testdir/test_ex_mode.vim @@ -316,4 +316,20 @@ func Test_global_insert_newline() bwipe! endfunc +" An empty command followed by a newline shouldn't cause E749 in Ex mode. +func Test_ex_empty_command_newline() + let g:var = 0 + call feedkeys("gQexecute \"\\nlet g:var = 1\"\r", 'xt') + call assert_equal(1, g:var) + call feedkeys("gQexecute \" \\nlet g:var = 2\"\r", 'xt') + call assert_equal(2, g:var) + call feedkeys("gQexecute \"\\t \\nlet g:var = 3\"\r", 'xt') + call assert_equal(3, g:var) + call feedkeys("gQexecute \"\\\"?!\\nlet g:var = 4\"\r", 'xt') + call assert_equal(4, g:var) + call feedkeys("gQexecute \" \\\"?!\\nlet g:var = 5\"\r", 'xt') + call assert_equal(5, g:var) + unlet g:var +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 76aa3e52be7a5a8b53b3775981c35313284230ac Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 5 Sep 2024 05:56:00 -0700 Subject: feat(defaults): popupmenu "Open in browser", "Go to definition" #30261 - Use the popup to expose more features such as LSP and gx. - Move the copy/paste items lower in the menu, they are lower priority. --- test/old/testdir/setup.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/setup.vim b/test/old/testdir/setup.vim index 6f400c5e32..e7b4bb1a88 100644 --- a/test/old/testdir/setup.vim +++ b/test/old/testdir/setup.vim @@ -66,6 +66,7 @@ mapclear mapclear! aunmenu * tlunmenu * +autocmd! nvim_popupmenu " Undo the 'grepprg' and 'grepformat' setting in _defaults.lua. set grepprg& grepformat& -- cgit From d60c753cffc4a6e7a33e6c94a6ffbe5bbafad13b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 6 Sep 2024 06:52:13 +0800 Subject: vim-patch:9.1.0716: resetting setcellwidth() doesn't update the screen (#30274) Problem: resetting setcellwidth() doesn't update the screen Solution: Redraw after clearing the cellwidth table (Ken Takata) closes: vim/vim#15628 https://github.com/vim/vim/commit/539e9b571ae2a80dfa8a42eb132ad9f65f0bbcbc Co-authored-by: Ken Takata --- test/old/testdir/test_utf8.vim | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_utf8.vim b/test/old/testdir/test_utf8.vim index 3248dc9d98..f46fb9d744 100644 --- a/test/old/testdir/test_utf8.vim +++ b/test/old/testdir/test_utf8.vim @@ -228,6 +228,9 @@ func Test_setcellwidths() call setcellwidths([[0x2103, 0x2103, 2]]) redraw call assert_equal(19, wincol()) + call setcellwidths([]) + redraw + call assert_equal((aw == 'single') ? 10 : 19, wincol()) endfor set ambiwidth& isprint& -- cgit From 738a84de09a053a01e9fc167722aed36cc782a1f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 7 Sep 2024 07:36:51 +0800 Subject: vim-patch:9.1.0719: Resetting cell widths can make 'listchars' or 'fillchars' invalid (#30289) Problem: Resetting cell widths can make 'listchars' or 'fillchars' invalid. Solution: Check for conflicts when resetting cell widths (zeertzjq). closes: vim/vim#15629 https://github.com/vim/vim/commit/66f65a46c5d169f20f780721d4f74d4729855b96 --- test/old/testdir/test_utf8.vim | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_utf8.vim b/test/old/testdir/test_utf8.vim index f46fb9d744..5cac4066ea 100644 --- a/test/old/testdir/test_utf8.vim +++ b/test/old/testdir/test_utf8.vim @@ -255,15 +255,21 @@ func Test_setcellwidths() call assert_fails('call setcellwidths([[0x33, 0x44, 2]])', 'E1114:') - set listchars=tab:--\\u2192 + set listchars=tab:--\\u2192 fillchars=stl:\\u2501 call assert_fails('call setcellwidths([[0x2192, 0x2192, 2]])', 'E834:') - - set fillchars=stl:\\u2501 call assert_fails('call setcellwidths([[0x2501, 0x2501, 2]])', 'E835:') + call setcellwidths([[0x201c, 0x201d, 1]]) + set listchars& fillchars& ambiwidth=double + + set listchars=nbsp:\\u201c fillchars=vert:\\u201d + call assert_fails('call setcellwidths([])', 'E834:') set listchars& + call assert_fails('call setcellwidths([])', 'E835:') set fillchars& + call setcellwidths([]) + set ambiwidth& bwipe! endfunc -- cgit From 3d1110674ec330138ad6675f828673ca32575d4b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 7 Sep 2024 18:50:52 +0800 Subject: vim-patch:9.1.0720: Wrong breakindentopt=list:-1 with multibyte or TABs (#30293) Problem: Wrong breakindentopt=list:-1 with multibyte chars or TABs in text matched by 'formatlistpat' (John M Devin) Solution: Use the width of the match text (zeertzjq) fixes: vim/vim#15634 closes: vim/vim#15635 https://github.com/vim/vim/commit/61a6ac4d0066317131528f1b3ecc3b3a2599a75c --- test/old/testdir/test_breakindent.vim | 65 ++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 5 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_breakindent.vim b/test/old/testdir/test_breakindent.vim index f09ab8684f..3787747104 100644 --- a/test/old/testdir/test_breakindent.vim +++ b/test/old/testdir/test_breakindent.vim @@ -837,18 +837,73 @@ func Test_breakindent20_list() \ ] let lines = s:screen_lines2(1, 9, 20) call s:compare_lines(expect, lines) + + " check with TABs + call setline(1, ["\t1.\tCongress shall make no law", + \ "\t2.) Congress shall make no law", + \ "\t3.] Congress shall make no law"]) + setl tabstop=4 list listchars=tab:<-> + norm! 1gg + redraw! + let expect = [ + \ "<-->1.<>Congress ", + \ " shall make ", + \ " no law ", + \ "<-->2.) Congress ", + \ " shall make ", + \ " no law ", + \ "<-->3.] Congress ", + \ " shall make ", + \ " no law ", + \ ] + let lines = s:screen_lines2(1, 9, 20) + call s:compare_lines(expect, lines) + + setl tabstop=2 nolist + redraw! + let expect = [ + \ " 1. Congress ", + \ " shall make no ", + \ " law ", + \ " 2.) Congress ", + \ " shall make no ", + \ " law ", + \ " 3.] Congress ", + \ " shall make no ", + \ " law ", + \ ] + let lines = s:screen_lines2(1, 9, 20) + call s:compare_lines(expect, lines) + + setl tabstop& list listchars=space:_ + redraw! + let expect = [ + \ "^I1.^ICongress_ ", + \ " shall_make_no_", + \ " law ", + \ "^I2.)_Congress_ ", + \ " shall_make_no_", + \ " law ", + \ "^I3.]_Congress_ ", + \ " shall_make_no_", + \ " law ", + \ ] + let lines = s:screen_lines2(1, 9, 20) + call s:compare_lines(expect, lines) + " check formatlistpat indent with different list levels - let &l:flp = '^\s*\*\+\s\+' + let &l:flp = '^\s*\(\*\|•\)\+\s\+' + setl list&vim listchars&vim %delete _ call setline(1, ['* Congress shall make no law', - \ '*** Congress shall make no law', + \ '••• Congress shall make no law', \ '**** Congress shall make no law']) norm! 1gg redraw! let expect = [ \ "* Congress shall ", \ " make no law ", - \ "*** Congress shall ", + \ "••• Congress shall ", \ " make no law ", \ "**** Congress shall ", \ " make no law ", @@ -864,7 +919,7 @@ func Test_breakindent20_list() let expect = [ \ "* Congress shall ", \ "> make no law ", - \ "*** Congress shall ", + \ "••• Congress shall ", \ "> make no law ", \ "**** Congress shall ", \ "> make no law ", @@ -880,7 +935,7 @@ func Test_breakindent20_list() let expect = [ \ "* Congress shall ", \ "> make no law ", - \ "*** Congress shall ", + \ "••• Congress shall ", \ "> make no law ", \ "**** Congress shall ", \ "> make no law ", -- cgit From 48c14d3544d32ca5e9726d1a07acaeb296097c8b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 12 Sep 2024 15:16:58 +0800 Subject: vim-patch:9.1.0725: filetype: swiftinterface files are not recognized (#30350) Problem: filetype: swiftinterface files are not recognized Solution: Detect '*.swiftinterface' files as swift filetype (LosFarmosCTL) closes: vim/vim#15658 https://github.com/vim/vim/commit/03cac4b70d819148f4b4404701b8f331a3af0fb6 Co-authored-by: LosFarmosCTL <80157503+LosFarmosCTL@users.noreply.github.com> --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 7e7a29d9cc..9c47dfa16f 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -710,7 +710,7 @@ func s:GetFilenameChecks() abort \ 'svg': ['file.svg'], \ 'svn': ['svn-commitfile.tmp', 'svn-commit-file.tmp', 'svn-commit.tmp'], \ 'swayconfig': ['/home/user/.sway/config', '/home/user/.config/sway/config', '/etc/sway/config', '/etc/xdg/sway/config'], - \ 'swift': ['file.swift'], + \ 'swift': ['file.swift', 'file.swiftinterface'], \ 'swiftgyb': ['file.swift.gyb'], \ 'swig': ['file.swg', 'file.swig'], \ 'sysctl': ['/etc/sysctl.conf', '/etc/sysctl.d/file.conf', 'any/etc/sysctl.conf', 'any/etc/sysctl.d/file.conf'], -- cgit From 90585e47feb7b4c4d878ad32480e2fc09744a7ed Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 14 Sep 2024 19:20:56 +0800 Subject: vim-patch:9.1.0729: Wrong cursor-screenline when resizing window Problem: Wrong cursor-screenline when resizing window Solution: Invalidate saved left_col and right_col when width1 or width2 change. closes: vim/vim#15679 https://github.com/vim/vim/commit/86dc4f8b432233a01d022c3e71df53db58229713 --- test/old/testdir/test_cursorline.vim | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cursorline.vim b/test/old/testdir/test_cursorline.vim index 99a812b1de..d9c77c0b36 100644 --- a/test/old/testdir/test_cursorline.vim +++ b/test/old/testdir/test_cursorline.vim @@ -262,14 +262,34 @@ func Test_cursorline_callback() call timer_start(300, 'Func') END - call writefile(lines, 'Xcul_timer') + call writefile(lines, 'Xcul_timer', 'D') let buf = RunVimInTerminal('-S Xcul_timer', #{rows: 8}) call TermWait(buf, 310) call VerifyScreenDump(buf, 'Test_cursorline_callback_1', {}) call StopVimInTerminal(buf) - call delete('Xcul_timer') +endfunc + +func Test_cursorline_screenline_resize() + CheckScreendump + + let lines =<< trim END + 50vnew + call setline(1, repeat('xyz ', 30)) + setlocal number cursorline cursorlineopt=screenline + normal! $ + END + call writefile(lines, 'Xcul_screenline_resize', 'D') + + let buf = RunVimInTerminal('-S Xcul_screenline_resize', #{rows: 8}) + call VerifyScreenDump(buf, 'Test_cursorline_screenline_resize_1', {}) + call term_sendkeys(buf, ":vertical resize -4\") + call VerifyScreenDump(buf, 'Test_cursorline_screenline_resize_2', {}) + call term_sendkeys(buf, ":set cpoptions+=n\") + call VerifyScreenDump(buf, 'Test_cursorline_screenline_resize_3', {}) + + call StopVimInTerminal(buf) endfunc func Test_cursorline_screenline_update() -- cgit From 5191a11d66b925561b5f705aa42759a0e2a5624a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 14 Sep 2024 19:28:13 +0800 Subject: vim-patch:9.1.0730: Crash with cursor-screenline and narrow window Problem: Crash with cursor-screenline and narrow window (elig0n) Solution: Don't set right_col when width2 is 0 (zeertzjq). fixes: vim/vim#15677 closes: vim/vim#15678 https://github.com/vim/vim/commit/59149f02692804267e7cc0665d0334f6ff4675be --- test/old/testdir/test_cursorline.vim | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cursorline.vim b/test/old/testdir/test_cursorline.vim index d9c77c0b36..2c375f20c0 100644 --- a/test/old/testdir/test_cursorline.vim +++ b/test/old/testdir/test_cursorline.vim @@ -300,7 +300,7 @@ func Test_cursorline_screenline_update() set cursorline cursorlineopt=screenline inoremap call cursor(1, 1) END - call writefile(lines, 'Xcul_screenline') + call writefile(lines, 'Xcul_screenline', 'D') let buf = RunVimInTerminal('-S Xcul_screenline', #{rows: 8}) call term_sendkeys(buf, "A") @@ -310,7 +310,17 @@ func Test_cursorline_screenline_update() call term_sendkeys(buf, "\") call StopVimInTerminal(buf) - call delete('Xcul_screenline') +endfunc + +func Test_cursorline_screenline_zero_width() + CheckOption foldcolumn + + set cursorline culopt=screenline winminwidth=1 foldcolumn=1 + " This used to crash Vim + 1vnew | redraw + + bwipe! + set cursorline& culopt& winminwidth& foldcolumn& endfunc func Test_cursorline_cursorbind_horizontal_scroll() -- cgit From 325d349f9da4518447ed34b327c261bfa56fc268 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 14 Sep 2024 19:38:33 +0800 Subject: vim-patch:9.1.0728: [security]: heap-use-after-free in garbage collection with location list user data (#30377) Problem: heap-use-after-free in garbage collection with location list user data. Solution: Mark user data as in use when no other window is referencing the location list (zeertzjq) fixes: neovim/neovim#30371 closes: vim/vim#15683 https://github.com/vim/vim/commit/be4bd189d23854ddf1d85ad291d8f7ad3f22b7a0 --- test/old/testdir/test_quickfix.vim | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_quickfix.vim b/test/old/testdir/test_quickfix.vim index 7eb2945198..524e8608f6 100644 --- a/test/old/testdir/test_quickfix.vim +++ b/test/old/testdir/test_quickfix.vim @@ -4071,11 +4071,23 @@ func Test_ll_window_ctx() enew | only endfunc +" Similar to the problem above, but for user data. +func Test_ll_window_user_data() + call setloclist(0, [#{bufnr: bufnr(), user_data: {}}]) + lopen + wincmd t + close + call test_garbagecollect_now() + call feedkeys("\", 'tx') + call test_garbagecollect_now() + %bwipe! +endfunc + " The following test used to crash vim func Test_lfile_crash() sp Xtest au QuickFixCmdPre * bw - call assert_fails('lfile', 'E40') + call assert_fails('lfile', 'E40:') au! QuickFixCmdPre endfunc -- cgit From f408603f4fc10ef2ff2dd3b6550365109b0b6214 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 15 Sep 2024 19:32:19 +0200 Subject: vim-patch:9.1.0731: inconsistent case sensitive extension matching Problem: inconsistent case sensitive extension matching Solution: unify case sensitive extension matching (Evgeni Chasnovski). There are different approaches of how extensions are matched with respect to case sensitivity. In particular, '\c' flag is used in pattern whereas in most places case sensitive matching is guarded behind `has("fname_case")` condition. Replace all instances of '\c' with an explicit case sensitive pattern variants guarded by `has("fname_case")`. Strictly speaking, this is a breaking change because only two (most common and prevailingly tested) variants are now matched: upper first letter and upper all letters. closes: vim/vim#15672 https://github.com/vim/vim/commit/59b089c9df238ce940b3c593295bc511e201399a Co-authored-by: Evgeni Chasnovski --- test/old/testdir/test_filetype.vim | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 9c47dfa16f..33f8df4081 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -1150,15 +1150,14 @@ func Test_cfg_file() unlet g:filetype_cfg " RAPID cfg - let ext = 'cfg' for i in ['EIO', 'MMC', 'MOC', 'PROC', 'SIO', 'SYS'] - call writefile([i .. ':CFG'], 'cfgfile.' .. ext) - execute "split cfgfile." .. ext - call assert_equal('rapid', &filetype) - bwipe! - call delete('cfgfile.' .. ext) - " check different case of file extension - let ext = substitute(ext, '\(\l\)', '\u\1', '') + for ext in ['cfg', 'Cfg', 'CFG'] + call writefile([i .. ':CFG'], 'cfgfile.' .. ext) + execute "split cfgfile." .. ext + call assert_equal('rapid', &filetype) + bwipe! + call delete('cfgfile.' .. ext) + endfor endfor " clean up -- cgit From 13d6f6cbb2337c1db5b3fceb607d36a2a632dc03 Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Tue, 17 Sep 2024 14:15:58 -0500 Subject: vim-patch:9.1.0734: filetype: jinja files are not recognized Problem: filetype: jinja files are not recognized Solution: detect '*.jinja' files a jinja filetype, include jinja syntax script (Gregory Anders) related: vim/vim#15689 https://github.com/vim/vim/commit/202c467bb37b894ada6377d3f2621c103f324757 Co-authored-by: Gregory Anders --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 33f8df4081..31a51f1254 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -366,6 +366,7 @@ func s:GetFilenameChecks() abort \ 'javascriptreact': ['file.jsx'], \ 'jess': ['file.clp'], \ 'jgraph': ['file.jgr'], + \ 'jinja': ['file.jinja'], \ 'jj': ['file.jjdescription'], \ 'jq': ['file.jq'], \ 'jovial': ['file.jov', 'file.j73', 'file.jovial'], -- cgit From 9a3f74c4c7fa567bb492cc3604b6baca05c22f1a Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Tue, 17 Sep 2024 14:17:51 -0500 Subject: vim-patch:9.1.0735: filetype: salt files are not recognized Problem: filetype: salt files are not recognized Solution: Detect '*.sls' files as filetype salt, include a syntax script (Gregory Anders) closes: vim/vim#15689 https://github.com/vim/vim/commit/89b9bb4ac8ceb701ebecb8c02aca3d047dff9991 Co-authored-by: Gregory Anders --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 31a51f1254..51b6f884f4 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -633,6 +633,7 @@ func s:GetFilenameChecks() abort \ 'rtf': ['file.rtf'], \ 'ruby': ['.irbrc', 'irbrc', '.irb_history', 'irb_history', 'file.rb', 'file.rbw', 'file.gemspec', 'file.ru', 'Gemfile', 'file.builder', 'file.rxml', 'file.rjs', 'file.rant', 'file.rake', 'rakefile', 'Rakefile', 'rantfile', 'Rantfile', 'rakefile-file', 'Rakefile-file', 'Puppetfile', 'Vagrantfile'], \ 'rust': ['file.rs'], + \ 'salt': ['file.sls'], \ 'samba': ['smb.conf'], \ 'sas': ['file.sas'], \ 'sass': ['file.sass'], -- cgit From d28be6fe692e90707534c1fd9ca57207a39c9f19 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 21 Sep 2024 20:21:15 +0800 Subject: vim-patch:9.1.0738: filetype: rapid files are not recognized Problem: filetype: rapid files are not recognized Solution: detect '*.sysx' and '*.modx' as rapid filetype (KnoP-01) closes: vim/vim#15669 https://github.com/vim/vim/commit/fdcb08264d6e8525a07b29c14863adc6ead83913 Co-authored-by: KnoP-01 --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 51b6f884f4..f802498336 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -601,6 +601,7 @@ func s:GetFilenameChecks() abort \ 'radiance': ['file.rad', 'file.mat'], \ 'raku': ['file.pm6', 'file.p6', 'file.t6', 'file.pod6', 'file.raku', 'file.rakumod', 'file.rakudoc', 'file.rakutest'], \ 'raml': ['file.raml'], + \ 'rapid': ['file.sysx', 'file.Sysx', 'file.SysX', 'file.SYSx', 'file.SYSX', 'file.modx', 'file.Modx', 'file.ModX', 'file.MODx', 'file.MODX'], \ 'rasi': ['file.rasi'], \ 'ratpoison': ['.ratpoisonrc', 'ratpoisonrc'], \ 'rbs': ['file.rbs'], -- cgit From bfe0acaea167a5ce18d4c63f65ccd45966203413 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 23 Sep 2024 12:04:07 +0800 Subject: vim-patch:9.1.0740: incorrect internal diff with empty file (#30471) Problem: incorrect internal diff with an empty file Solution: Set pointer to NULL, instead of using an empty line file (Yukihiro Nakadaira) When using internal diff, empty file is read as one empty line file. So result differs from external diff. closes: vim/vim#15719 https://github.com/vim/vim/commit/f1694b439bb175d956b49da620f1253462ec507b Co-authored-by: Yukihiro Nakadaira --- test/old/testdir/test_diffmode.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_diffmode.vim b/test/old/testdir/test_diffmode.vim index 31d66ebc4a..84cb7eb376 100644 --- a/test/old/testdir/test_diffmode.vim +++ b/test/old/testdir/test_diffmode.vim @@ -997,9 +997,17 @@ func Test_diff_screen() call WriteDiffFiles(buf, ['a ', 'x', 'cd', 'ef', 'xx xx', 'foo', 'bar'], ['a', 'x', 'c d', ' ef', 'xx xx', 'foo', '', 'bar']) call VerifyInternal(buf, 'Test_diff_19', " diffopt+=iwhiteeol") - " Test 19: test diffopt+=iwhiteall + " Test 20: test diffopt+=iwhiteall call VerifyInternal(buf, 'Test_diff_20', " diffopt+=iwhiteall") + " Test 21: Delete all lines + call WriteDiffFiles(buf, [0], []) + call VerifyBoth(buf, "Test_diff_21", "") + + " Test 22: Add line to empty file + call WriteDiffFiles(buf, [], [0]) + call VerifyBoth(buf, "Test_diff_22", "") + " clean up call StopVimInTerminal(buf) call delete('Xdifile1') -- cgit From c2fb1fc700db28cb554be9da8e79443b5d3a5fe9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 24 Sep 2024 06:51:02 +0800 Subject: vim-patch:9.1.0741: No way to get prompt for input()/confirm() Problem: No way to get prompt for input()/confirm() Solution: add getcmdprompt() function (Shougo Matsushita) (Shougo Matsushita) closes: vim/vim#15667 https://github.com/vim/vim/commit/6908428560a0d6ae27bf7af6fcb6dc362e31926c Co-authored-by: Shougo Matsushita --- test/old/testdir/test_cmdline.vim | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index d00b5bbf46..ba71f4b785 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -1534,7 +1534,7 @@ endfunc set cpo& -func Test_getcmdtype() +func Test_getcmdtype_getcmdprompt() call feedkeys(":MyCmd a\=Check_cmdline(':')\\", "xt") let cmdtype = '' @@ -1558,6 +1558,20 @@ func Test_getcmdtype() cunmap call assert_equal('', getcmdline()) + + call assert_equal('', getcmdprompt()) + augroup test_CmdlineEnter + autocmd! + autocmd CmdlineEnter * let g:cmdprompt=getcmdprompt() + augroup END + call feedkeys(":call input('Answer?')\a\\", "xt") + call assert_equal('Answer?', g:cmdprompt) + call assert_equal('', getcmdprompt()) + + augroup test_CmdlineEnter + au! + augroup END + augroup! test_CmdlineEnter endfunc func Test_getcmdwintype() -- cgit From 65b6cd1b3a43024f6c2d9d6f31b8ae3a69dabb56 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 26 Sep 2024 22:15:54 +0800 Subject: vim-patch:9.1.0742: getcmdprompt() implementation can be improved Problem: getcmdprompt() implementation can be improved Solution: Improve and simplify it (h-east) closes: vim/vim#15743 https://github.com/vim/vim/commit/25876a6cdd439054d0b3f920ccca0a435481de15 Co-authored-by: h-east --- test/old/testdir/test_cmdline.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index ba71f4b785..d8a217fd05 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -1567,6 +1567,17 @@ func Test_getcmdtype_getcmdprompt() call feedkeys(":call input('Answer?')\a\\", "xt") call assert_equal('Answer?', g:cmdprompt) call assert_equal('', getcmdprompt()) + call feedkeys(":\\", "xt") + call assert_equal('', g:cmdprompt) + call assert_equal('', getcmdprompt()) + + let str = "C" .. repeat("c", 1023) .. "xyz" + call feedkeys(":call input('" .. str .. "')\\\", "xt") + call assert_equal(str, g:cmdprompt) + + call feedkeys(':call input("Msg1\nMessage2\nAns?")' .. "\b\\", "xt") + call assert_equal('Ans?', g:cmdprompt) + call assert_equal('', getcmdprompt()) augroup test_CmdlineEnter au! -- cgit From 6f2fe8a791646d6d662e89d7eccf6c515ccc9c8c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 27 Sep 2024 15:14:39 +0800 Subject: vim-patch:9.1.0743: diff mode does not handle overlapping diffs correctly (#30532) Problem: diff mode does not handle overlapping diffs correctly Solution: correct the logic to handle overlapping blocks (Yukihiro Nakadaira) Vim merges overlapped diff blocks and it doesn't work expectedly in some situation. closes: vim/vim#15735 https://github.com/vim/vim/commit/06fe70c183a53ea97cd42ace490d4fb9fd14f042 Co-authored-by: Yukihiro Nakadaira --- test/old/testdir/test_diffmode.vim | 208 +++++++++++++++++++++++++++++++++++++ 1 file changed, 208 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_diffmode.vim b/test/old/testdir/test_diffmode.vim index 84cb7eb376..a448ed9b7f 100644 --- a/test/old/testdir/test_diffmode.vim +++ b/test/old/testdir/test_diffmode.vim @@ -830,6 +830,15 @@ func WriteDiffFiles(buf, list1, list2) endif endfunc +func WriteDiffFiles3(buf, list1, list2, list3) + call writefile(a:list1, 'Xdifile1') + call writefile(a:list2, 'Xdifile2') + call writefile(a:list3, 'Xdifile3') + if a:buf + call term_sendkeys(a:buf, ":checktime\") + endif +endfunc + " Verify a screendump with both the internal and external diff. func VerifyBoth(buf, dumpfile, extra) " trailing : for leaving the cursor on the command line @@ -1799,4 +1808,203 @@ func Test_diff_eob_halfpage() %bwipe! endfunc +func Test_diff_overlapped_diff_blocks_will_be_merged() + CheckScreendump + + let lines =<< trim END + func DiffExprStub() + let txt_in = readfile(v:fname_in) + let txt_new = readfile(v:fname_new) + if txt_in == ["line1"] && txt_new == ["line2"] + call writefile(["1c1"], v:fname_out) + elseif txt_in == readfile("Xdiin1") && txt_new == readfile("Xdinew1") + call writefile(readfile("Xdiout1"), v:fname_out) + elseif txt_in == readfile("Xdiin2") && txt_new == readfile("Xdinew2") + call writefile(readfile("Xdiout2"), v:fname_out) + endif + endfunc + END + call writefile(lines, 'XdiffSetup', 'D') + + call WriteDiffFiles(0, [], []) + let buf = RunVimInTerminal('-d -S XdiffSetup Xdifile1 Xdifile2', {}) + call term_sendkeys(buf, ":set autoread\\w:set autoread\\w") + + call WriteDiffFiles(buf, ["a", "b"], ["x", "x"]) + call writefile(["a", "b"], "Xdiin1") + call writefile(["x", "x"], "Xdinew1") + call writefile(["1c1", "2c2"], "Xdiout1") + call term_sendkeys(buf, ":set diffexpr=DiffExprStub()\:") + call VerifyBoth(buf, "Test_diff_overlapped_2.01", "") + call term_sendkeys(buf, ":set diffexpr&\:") + + call WriteDiffFiles(buf, ["a", "b", "c"], ["x", "c"]) + call writefile(["a", "b", "c"], "Xdiin1") + call writefile(["x", "c"], "Xdinew1") + call writefile(["1c1", "2d1"], "Xdiout1") + call term_sendkeys(buf, ":set diffexpr=DiffExprStub()\:") + call VerifyBoth(buf, "Test_diff_overlapped_2.02", "") + call term_sendkeys(buf, ":set diffexpr&\:") + + call WriteDiffFiles(buf, ["a", "c"], ["x", "x", "c"]) + call writefile(["a", "c"], "Xdiin1") + call writefile(["x", "x", "c"], "Xdinew1") + call writefile(["1c1", "1a2"], "Xdiout1") + call term_sendkeys(buf, ":set diffexpr=DiffExprStub()\:") + call VerifyBoth(buf, "Test_diff_overlapped_2.03", "") + call term_sendkeys(buf, ":set diffexpr&\:") + + call StopVimInTerminal(buf) + wincmd c + + call WriteDiffFiles3(0, [], [], []) + let buf = RunVimInTerminal('-d -S XdiffSetup Xdifile1 Xdifile2 Xdifile3', {}) + call term_sendkeys(buf, ":set autoread\\w:set autoread\\w:set autoread\\w") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], ["y", "b", "c"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.01", "") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], ["a", "y", "c"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.02", "") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], ["a", "b", "y"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.03", "") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], ["y", "y", "c"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.04", "") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], ["a", "y", "y"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.05", "") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], ["y", "y", "y"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.06", "") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "x"], ["y", "y", "c"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.07", "") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["x", "x", "c"], ["a", "y", "y"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.08", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["y", "y", "y", "d", "e"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.09", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["y", "y", "y", "y", "e"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.10", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["y", "y", "y", "y", "y"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.11", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["a", "y", "y", "d", "e"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.12", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["a", "y", "y", "y", "e"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.13", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["a", "y", "y", "y", "y"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.14", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["a", "b", "y", "d", "e"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.15", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["a", "b", "y", "y", "e"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.16", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["a", "b", "y", "y", "y"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.17", "") + + call WriteDiffFiles3(buf, ["a", "b"], ["x", "b"], ["y", "y"]) + call writefile(["a", "b"], "Xdiin1") + call writefile(["x", "b"], "Xdinew1") + call writefile(["1c1"], "Xdiout1") + call writefile(["a", "b"], "Xdiin2") + call writefile(["y", "y"], "Xdinew2") + call writefile(["1c1", "2c2"], "Xdiout2") + call term_sendkeys(buf, ":set diffexpr=DiffExprStub()\:") + call VerifyInternal(buf, "Test_diff_overlapped_3.18", "") + call term_sendkeys(buf, ":set diffexpr&\:") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d"], ["x", "b", "x", "d"], ["y", "y", "c", "d"]) + call writefile(["a", "b", "c", "d"], "Xdiin1") + call writefile(["x", "b", "x", "d"], "Xdinew1") + call writefile(["1c1", "3c3"], "Xdiout1") + call writefile(["a", "b", "c", "d"], "Xdiin2") + call writefile(["y", "y", "c", "d"], "Xdinew2") + call writefile(["1c1", "2c2"], "Xdiout2") + call term_sendkeys(buf, ":set diffexpr=DiffExprStub()\:") + call VerifyInternal(buf, "Test_diff_overlapped_3.19", "") + call term_sendkeys(buf, ":set diffexpr&\:") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d"], ["x", "b", "x", "d"], ["y", "y", "y", "d"]) + call writefile(["a", "b", "c", "d"], "Xdiin1") + call writefile(["x", "b", "x", "d"], "Xdinew1") + call writefile(["1c1", "3c3"], "Xdiout1") + call writefile(["a", "b", "c", "d"], "Xdiin2") + call writefile(["y", "y", "y", "d"], "Xdinew2") + call writefile(["1c1", "2,3c2,3"], "Xdiout2") + call term_sendkeys(buf, ":set diffexpr=DiffExprStub()\:") + call VerifyInternal(buf, "Test_diff_overlapped_3.20", "") + call term_sendkeys(buf, ":set diffexpr&\:") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d"], ["x", "b", "x", "d"], ["y", "y", "y", "y"]) + call writefile(["a", "b", "c", "d"], "Xdiin1") + call writefile(["x", "b", "x", "d"], "Xdinew1") + call writefile(["1c1", "3c3"], "Xdiout1") + call writefile(["a", "b", "c", "d"], "Xdiin2") + call writefile(["y", "y", "y", "y"], "Xdinew2") + call writefile(["1c1", "2,4c2,4"], "Xdiout2") + call term_sendkeys(buf, ":set diffexpr=DiffExprStub()\:") + call VerifyInternal(buf, "Test_diff_overlapped_3.21", "") + call term_sendkeys(buf, ":set diffexpr&\:") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], ["b", "c"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.22", "") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], ["c"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.23", "") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], []) + call VerifyBoth(buf, "Test_diff_overlapped_3.24", "") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], ["a", "c"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.25", "") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], ["a"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.26", "") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], ["b"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.27", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["d", "e"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.28", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["e"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.29", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["a", "d", "e"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.30", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["a", "e"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.31", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["a"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.32", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["a", "b", "d", "e"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.33", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["a", "b", "e"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.34", "") + + call WriteDiffFiles3(buf, ["a", "b", "c", "d", "e"], ["a", "x", "c", "x", "e"], ["a", "b"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.35", "") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], ["a", "y", "b", "c"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.36", "") + + call WriteDiffFiles3(buf, ["a", "b", "c"], ["a", "x", "c"], ["a", "b", "y", "c"]) + call VerifyBoth(buf, "Test_diff_overlapped_3.37", "") + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 60a75780586ee7ab001529f3d0d0d3fe17c341eb Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 27 Sep 2024 18:57:01 +0800 Subject: vim-patch:9.1.0744: filetype: notmuch configs are not recognised (#30535) Problem: filetype: notmuch configs are not recognised Solution: Detect more notmuch profile configuration files as dosini filetype (Julio B) Reference: https://notmuchmail.org/doc/latest/man1/notmuch-config.html#configuration closes: vim/vim#15744 https://github.com/vim/vim/commit/1a2870b57aa832500d59c17c8225a64c2b4aa619 Co-authored-by: Julio B --- test/old/testdir/test_filetype.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index f802498336..8a1ed413c0 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -224,7 +224,8 @@ func s:GetFilenameChecks() abort \ '.coveragerc', '.pypirc', '.gitlint', '.oelint.cfg', 'pylintrc', '.pylintrc', \ '/home/user/.config/bpython/config', '/home/user/.config/mypy/config', '.wakatime.cfg', '.replyrc', \ 'psprint.conf', 'sofficerc', 'any/.config/lxqt/globalkeyshortcuts.conf', 'any/.config/screengrab/screengrab.conf', - \ 'any/.local/share/flatpak/repo/config', '.notmuch-config'], + \ 'any/.local/share/flatpak/repo/config', '.notmuch-config', '.notmuch-config.myprofile', + \ '~/.config/notmuch/myprofile/config'] + s:WhenConfigHome('$XDG_CONFIG_HOME/notmuch/myprofile/config'), \ 'dot': ['file.dot', 'file.gv'], \ 'dracula': ['file.drac', 'file.drc', 'file.lvs', 'file.lpe', 'drac.file'], \ 'dtd': ['file.dtd'], -- cgit From 1ff0a1712ad6ecab37b7126a3a7278bb9dab0d6b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 29 Sep 2024 17:05:56 +0800 Subject: vim-patch:9.1.0746: tests: Test_halfpage_longline() fails on large terminals (#30567) Problem: Test_halfpage_longline() fails on large terminals (lazypingu) Solution: Use a window with known width (zeertzjq). fixes: vim/vim#15755 closes: vim/vim#15756 https://github.com/vim/vim/commit/fa117387eea97306e4c59043b607ccb1533f64ea --- test/old/testdir/test_normal.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index 3ebc9a69a4..469a568820 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -4276,6 +4276,7 @@ endfunc " Test for Ctrl-D with long line func Test_halfpage_longline() 10new + 40vsplit call setline(1, ['long'->repeat(1000), 'short']) exe "norm! \" call assert_equal(2, line('.')) -- cgit From 1405034ba3b1765e451304be0ee8ddc4d285ee87 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 29 Sep 2024 10:46:00 +0200 Subject: vim-patch:9.1.0745: filetype: bun and deno history files not recognized Problem: filetype: bun and deno history files not recognized Solution: detect '.bun_repl_history' and 'deno_history.txt' as javascript filetype (Wu, Zhenyu) closes: vim/vim#15761 https://github.com/vim/vim/commit/8a2aea8a623ba183dc0703a47970463b105a9399 Co-authored-by: Wu, Zhenyu --- test/old/testdir/test_filetype.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 8a1ed413c0..7480b15bed 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -362,7 +362,7 @@ func s:GetFilenameChecks() abort \ 'janet': ['file.janet'], \ 'java': ['file.java', 'file.jav'], \ 'javacc': ['file.jj', 'file.jjt'], - \ 'javascript': ['file.js', 'file.jsm', 'file.javascript', 'file.es', 'file.mjs', 'file.cjs', '.node_repl_history'], + \ 'javascript': ['file.js', 'file.jsm', 'file.javascript', 'file.es', 'file.mjs', 'file.cjs', '.node_repl_history', '.bun_repl_history', 'deno_history.txt'], \ 'javascript.glimmer': ['file.gjs'], \ 'javascriptreact': ['file.jsx'], \ 'jess': ['file.clp'], -- cgit From 2c937d723dd6f64705bf4d901254683ba32b2846 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 29 Sep 2024 11:54:12 +0200 Subject: docs: misc (#30177) Co-authored-by: Christian Clason Co-authored-by: Riley Bruins Co-authored-by: zeertzjq --- test/old/testdir/test_normal.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index 469a568820..46fddd6c1a 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -4284,7 +4284,7 @@ func Test_halfpage_longline() endfunc " Test for Ctrl-E with long line and very narrow window, -" used to cause an inifite loop +" used to cause an infinite loop func Test_scroll_longline_no_loop() 4vnew setl smoothscroll number showbreak=> scrolloff=2 -- cgit From ea9d61b80df3673f5cbd93ce67201f04ddbee961 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 1 Oct 2024 07:04:13 +0200 Subject: vim-patch:9.1.0749: filetype: http files not recognized Problem: filetype: http files not recognized Solution: detect '*.http' as http filetype, include http filetype plugin (Riley Bruins) Based on the specification found [here](https://github.com/JetBrains/http-request-in-editor-spec/blob/master/spec.md) closes: vim/vim#15762 https://github.com/vim/vim/commit/de6c1d1182076b10212342fd2d441267fbe43a22 Co-authored-by: Riley Bruins --- test/old/testdir/test_filetype.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 7480b15bed..d99656be47 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -340,6 +340,7 @@ func s:GetFilenameChecks() abort \ 'hostconf': ['/etc/host.conf', 'any/etc/host.conf'], \ 'hostsaccess': ['/etc/hosts.allow', '/etc/hosts.deny', 'any/etc/hosts.allow', 'any/etc/hosts.deny'], \ 'html': ['file.html', 'file.htm', 'file.cshtml', 'file.component.html'], + \ 'http': ['file.http'], \ 'htmlm4': ['file.html.m4'], \ 'httest': ['file.htt', 'file.htb'], \ 'hurl': ['file.hurl'], -- cgit From 0e484c2041f9196f61c2b5dfaed38e81d068680d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 2 Oct 2024 06:55:43 +0800 Subject: vim-patch:9.1.0753: Wrong display when typing in diff mode with 'smoothscroll' (#30614) Problem: Wrong display when typing in diff mode with 'smoothscroll'. Solution: Use adjust_plines_for_skipcol() (zeertzjq). closes: vim/vim#15776 https://github.com/vim/vim/commit/47f8584a80006cd25e7dc6fa7fb1bfe2e768403c --- test/old/testdir/test_scroll_opt.vim | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 5bf071903b..55f9a32718 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -302,6 +302,36 @@ func Test_smoothscroll_diff_mode() call StopVimInTerminal(buf) endfunc +func Test_smoothscroll_diff_change_line() + CheckScreendump + + let lines =<< trim END + set diffopt+=followwrap smoothscroll + call setline(1, repeat(' abc', &columns)) + call setline(2, 'bar') + call setline(3, repeat(' abc', &columns)) + vnew + call setline(1, repeat(' abc', &columns)) + call setline(2, 'foo') + call setline(3, 'bar') + call setline(4, repeat(' abc', &columns)) + windo exe "normal! 2gg5\" + windo diffthis + END + call writefile(lines, 'XSmoothDiffChangeLine', 'D') + let buf = RunVimInTerminal('-S XSmoothDiffChangeLine', #{rows: 20, columns: 55}) + + call VerifyScreenDump(buf, 'Test_smooth_diff_change_line_1', {}) + call term_sendkeys(buf, "Abar") + call VerifyScreenDump(buf, 'Test_smooth_diff_change_line_2', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smooth_diff_change_line_3', {}) + call term_sendkeys(buf, "yyp") + call VerifyScreenDump(buf, 'Test_smooth_diff_change_line_4', {}) + + call StopVimInTerminal(buf) +endfunc + func Test_smoothscroll_wrap_scrolloff_zero() CheckScreendump -- cgit From 6a2f8958e832aebc20cf42d8ade4cb58fe33df9e Mon Sep 17 00:00:00 2001 From: glepnir Date: Thu, 3 Oct 2024 06:45:01 +0800 Subject: vim-patch:9.1.0754: fixed order of items in insert-mode completion menu (#30619) Problem: fixed order of items in insert-mode completion menu Solution: Introduce the 'completeitemalign' option with default value "abbr,kind,menu" (glepnir). Adding an new option `completeitemalign` abbr is `cia` to custom the complete-item order in popupmenu. closes: vim/vim#14006 closes: vim/vim#15760 https://github.com/vim/vim/commit/6a89c94a9eeee53481ced1a1260a177bffde4c0f --- test/old/testdir/test_popup.vim | 60 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 2a038d7da4..f9c6d2eedd 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1583,4 +1583,64 @@ func Test_pum_user_kind_hlgroup() call StopVimInTerminal(buf) endfunc +func Test_pum_completeitemalign() + CheckScreendump + let lines =<< trim END + func Omni_test(findstart, base) + if a:findstart + return col(".") + endif + return { + \ 'words': [ + \ { 'word': 'foo', 'kind': 'S', 'menu': 'menu' }, + \ { 'word': 'bar', 'kind': 'T', 'menu': 'menu' }, + \ { 'word': '你好', 'kind': 'C', 'menu': '中文' }, + \]} + endfunc + set omnifunc=Omni_test + command! -nargs=0 T1 set cia=abbr,kind,menu + command! -nargs=0 T2 set cia=abbr,menu,kind + command! -nargs=0 T3 set cia=kind,abbr,menu + command! -nargs=0 T4 set cia=kind,menu,abbr + command! -nargs=0 T5 set cia=menu,abbr,kind + command! -nargs=0 T6 set cia=menu,kind,abbr + command! -nargs=0 T7 set cia& + END + call writefile(lines, 'Xscript', 'D') + let buf = RunVimInTerminal('-S Xscript', {}) + call TermWait(buf) + + " T1 is default + call term_sendkeys(buf, ":T1\S\\") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_01', {}) + call term_sendkeys(buf, "\\") + + " T2 + call term_sendkeys(buf, ":T2\S\\") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_02', {}) + call term_sendkeys(buf, "\\") + + " T3 + call term_sendkeys(buf, ":T3\S\\") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_03', {}) + call term_sendkeys(buf, "\\") + + " T4 + call term_sendkeys(buf, ":T4\S\\") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_04', {}) + call term_sendkeys(buf, "\\") + + " T5 + call term_sendkeys(buf, ":T5\S\\") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_05', {}) + call term_sendkeys(buf, "\\") + + " T6 + call term_sendkeys(buf, ":T6\S\\") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_06', {}) + call term_sendkeys(buf, "\\:T7\") + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From ae0e4071a8c90f96a66efc07f421fa7bf15f27f6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 3 Oct 2024 17:44:04 +0800 Subject: vim-patch:9.1.0755: quickfix list does not handle hardlinks well (#30637) Problem: quickfix list does not handle hardlinks well Solution: store original file name with quickfix entry (Austin Chang) Quickfix list shows entries with duplicate name if the file is opened with the path of hard links. The major cause is that qflist assumed that the filename passed into `qf_add_entry` matches the filename opened with the buffer. This patch handles this case by introduce a `qf_fname` into `qfline_S` structure. It stores the filename from `qf_add_entry` for each quickfix line. closes: vim/vim#15687 https://github.com/vim/vim/commit/29822996996550f68a781e85753ebd4d177f22da Co-authored-by: Austin Chang --- test/old/testdir/test_quickfix.vim | 46 ++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_quickfix.vim b/test/old/testdir/test_quickfix.vim index 524e8608f6..753875963b 100644 --- a/test/old/testdir/test_quickfix.vim +++ b/test/old/testdir/test_quickfix.vim @@ -4140,6 +4140,7 @@ endfunc " The following test used to crash Vim func Test_lvimgrep_crash() + " this leaves a swapfile .test_quickfix.vim.swp around, why? sv Xtest augroup QF_Test au! @@ -4202,8 +4203,8 @@ endfunc " :vimgrep/:lvimgrep commands are running. func Test_vimgrep_autocmd() call setqflist([], 'f') - call writefile(['stars'], 'Xtest1.txt') - call writefile(['stars'], 'Xtest2.txt') + call writefile(['stars'], 'Xtest1.txt', 'D') + call writefile(['stars'], 'Xtest2.txt', 'D') " Test 1: " When searching for a pattern using :vimgrep, if the quickfix list is @@ -4233,9 +4234,9 @@ func Test_vimgrep_autocmd() autocmd BufRead Xtest2.txt call setloclist(g:save_winid, [], 'f') call assert_fails('lvimgrep stars Xtest*.txt', 'E926:') au! BufRead Xtest2.txt + " cleanup the swap files + bw! Xtest2.txt Xtest1.txt - call delete('Xtest1.txt') - call delete('Xtest2.txt') call setqflist([], 'f') endfunc @@ -6458,4 +6459,41 @@ func Test_cbuffer_range() call XbufferTests_range('l') endfunc +" Test for displaying fname pass from setqflist when the name +" are hard links to prevent seemly duplicate entries. +func Xtest_hardlink_fname(cchar) + call s:setup_commands(a:cchar) + %bwipe + " Create a sample source file + let lines =<< trim END + void sample() {} + int main() { sample(); return 0; } + END + call writefile(lines, 'test_qf_hardlink1.c', 'D') + defer delete('test_qf_hardlink1.c') + defer delete('test_qf_hardlink2.c') + call system('ln test_qf_hardlink1.c test_qf_hardlink2.c') + if v:shell_error + throw 'Skipped: ln throws error on this platform' + endif + call g:Xsetlist([], 'f') + " Make a qflist that contains the file and it's hard link + " like how LSP plugins set response into qflist + call g:Xsetlist([{'filename' : 'test_qf_hardlink1.c', 'lnum' : 1}, + \ {'filename' : 'test_qf_hardlink2.c', 'lnum' : 1}], ' ') + Xopen + " Ensure that two entries are displayed with different name + " so that they aren't seen as duplication. + call assert_equal(['test_qf_hardlink1.c|1| ', + \ 'test_qf_hardlink2.c|1| '], getline(1, '$')) + Xclose +endfunc + +func Test_hardlink_fname() + CheckUnix + CheckExecutable ln + call Xtest_hardlink_fname('c') + call Xtest_hardlink_fname('l') +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From cc300e553b458e08c4b1d4be117ee51a289cbdee Mon Sep 17 00:00:00 2001 From: glepnir Date: Thu, 3 Oct 2024 17:58:15 +0800 Subject: vim-patch:9.1.0756: missing change from patch v9.1.0754 (#30636) Problem: missing change from patch v9.1.0754 Solution: use correct width for the actual item in pum_redraw() (glepnir) closes: vim/vim#15786 https://github.com/vim/vim/commit/a6d9e3c4e07f73f6523699961d8b7b54bdb80cf6 --- test/old/testdir/test_popup.vim | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index f9c6d2eedd..472882fb87 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1597,6 +1597,17 @@ func Test_pum_completeitemalign() \ { 'word': '你好', 'kind': 'C', 'menu': '中文' }, \]} endfunc + + func Omni_long(findstart, base) + if a:findstart + return col(".") + endif + return { + \ 'words': [ + \ { 'word': 'loooong_foo', 'kind': 'S', 'menu': 'menu' }, + \ { 'word': 'loooong_bar', 'kind': 'T', 'menu': 'menu' }, + \]} + endfunc set omnifunc=Omni_test command! -nargs=0 T1 set cia=abbr,kind,menu command! -nargs=0 T2 set cia=abbr,menu,kind @@ -1638,8 +1649,11 @@ func Test_pum_completeitemalign() " T6 call term_sendkeys(buf, ":T6\S\\") call VerifyScreenDump(buf, 'Test_pum_completeitemalign_06', {}) - call term_sendkeys(buf, "\\:T7\") + call term_sendkeys(buf, "\\") + call term_sendkeys(buf, ":set columns=12 cmdheight=2 omnifunc=Omni_long\S\\") + call VerifyScreenDump(buf, 'Test_pum_completeitemalign_07', {}) + call term_sendkeys(buf, "\\:T7\") call StopVimInTerminal(buf) endfunc -- cgit From 9f26bdc4165adf7de9bf0c231a386b02e85cbce0 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 6 Oct 2024 06:49:23 +0800 Subject: vim-patch:9.1.0759: screenpos() may return invalid position (#30681) Problem: screenpos() may return invalid position after switching buffers (Greg Hurrell) Solution: reset w_leftcol if wrapping has been set after copying wrap option fixes: vim/vim#15792 closes: vim/vim#15803 https://github.com/vim/vim/commit/b065a10e245d020c11b521a2a5062300ca9891fc Co-authored-by: Christian Brabandt --- test/old/testdir/test_cursor_func.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cursor_func.vim b/test/old/testdir/test_cursor_func.vim index 5d99963814..99af0ab359 100644 --- a/test/old/testdir/test_cursor_func.vim +++ b/test/old/testdir/test_cursor_func.vim @@ -279,6 +279,21 @@ func Test_screenpos_number() bwipe! endfunc +func Test_screenpos_edit_newfile() + new + 20vsp + setl nowrap + call setline(1, 'abcdefghijklmnopqrstuvwxyz') + call cursor(1, 10) + norm! 5zl + call assert_equal(#{col: 5, row: 1, endcol: 5, curscol: 5}, screenpos(win_getid(), 1, 10)) + enew! + call assert_equal(1, &l:wrap) + call assert_equal(#{col: 1, row: 1, endcol: 1, curscol: 1}, screenpos(win_getid(), 1, 1)) + + bwipe! +endfunc + " Save the visual start character position func SaveVisualStartCharPos() call add(g:VisualStartPos, getcharpos('v')) -- cgit From a4ebea18f1acb7c3069540f06361436b9675e3ab Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 6 Oct 2024 07:28:28 +0800 Subject: vim-patch:9.1.0003: Cannot build against Ruby 33 dynamically (#30683) Problem: Cannot build against Ruby 33 dynamically Solution: Ruby 33 removed transient heap, so do not use rb_ary_transient anymore, NoMethodError format changed, so update test for expected error message (Isao Sato) - ruby-3.3 removed transient heap for ruby/dyn when +ruby/dyn with ruby-3.3 do command :ruby, E448 occur. ruby-3.3 has no transient heap anymore, so disable rb_ary_transient etc. $ LC_ALL=C VIMRUNTIME=runtime ./src/vim -u NONE -c 'ruby puts RUBY_VERSION' "=> Error detected while processing command line: "=> E448: Could not load library function rb_ary_detransient "=> E266: Sorry, this command is disabled, the Ruby library could not be loaded. - ruby-3.3 changed NoMethodError format: $ rvm 3.2.2, 3.3.0-rc1 do ruby -e 'begin; nil.name; rescue => e; puts "%s : %s"%[RUBY_VERSION, e.message]; end ' => 3.2.2 : undefined method `name' for nil:NilClass => 3.3.0 : undefined method `name' for nil so loose pattern in Test_ruby_Vim_buffer_get() closes: vim/vim#13741 https://github.com/vim/vim/commit/443657b32becb2318ae40e30a849bbe5cc1a153c Co-authored-by: Isao Sato --- test/old/testdir/test_ruby.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_ruby.vim b/test/old/testdir/test_ruby.vim index 483e235636..d4a3dc3301 100644 --- a/test/old/testdir/test_ruby.vim +++ b/test/old/testdir/test_ruby.vim @@ -282,7 +282,7 @@ func Test_ruby_Vim_buffer_get() call assert_match('Xfoo1$', rubyeval('Vim::Buffer[1].name')) call assert_match('Xfoo2$', rubyeval('Vim::Buffer[2].name')) call assert_fails('ruby print Vim::Buffer[3].name', - \ "NoMethodError: undefined method `name' for nil:NilClass") + \ "NoMethodError: undefined method `name' for nil") %bwipe endfunc -- cgit From 40ec3d7bc0e255a1159f4b2c27c6dcea5d13ca3d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 7 Oct 2024 10:16:47 +0800 Subject: vim-patch:9.1.0761: :cd completion fails on Windows with backslash in path (#30703) Problem: :cd completion fails on Windows with backslash in path Solution: switch no_bslash argument to FALSE in file_pat_to_reg_pat() Note: only fixes the problem on Windows. For Unix, we still need to escape backslashes since those are taken as regex atoms (and could be invalid regex atoms). fixes: vim/vim#15643 closes: vim/vim#15808 https://github.com/vim/vim/commit/1a31c430bb175144d097ca607dbe10d7960f372a Co-authored-by: Christian Brabandt --- test/old/testdir/test_cmdline.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index d8a217fd05..9f25a42c38 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -4070,4 +4070,15 @@ func Test_term_option() let &cpo = _cpo endfunc +func Test_cd_bslsh_completion_windows() + CheckMSWindows + let save_shellslash = &shellslash + set noshellslash + call system('mkdir XXXa\_b') + defer delete('XXXa', 'rf') + call feedkeys(":cd XXXa\\_b\\\"\", 'tx') + call assert_equal('"cd XXXa\_b\', @:) + let &shellslash = save_shellslash +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 2377443cd27ac41429d77fc6ba41e21469ed3b5b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 7 Oct 2024 10:40:44 +0800 Subject: vim-patch:9.1.0764: [security]: use-after-free when closing a buffer (#30705) Problem: [security]: use-after-free when closing a buffer Solution: When splitting the window and editing a new buffer, check whether the newly to be edited buffer has been marked for deletion and abort in this case Github Advisory: https://github.com/vim/vim/security/advisories/GHSA-rj48-v4mq-j4vg https://github.com/vim/vim/commit/51b62387be93c65fa56bbabe1c3c1ea5df187641 Co-authored-by: Christian Brabandt --- test/old/testdir/test_autocmd.vim | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/old/testdir') diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim index 68aa2834d8..9d06ebb2be 100644 --- a/test/old/testdir/test_autocmd.vim +++ b/test/old/testdir/test_autocmd.vim @@ -15,6 +15,13 @@ func s:cleanup_buffers() abort endfor endfunc +func CleanUpTestAuGroup() + augroup testing + au! + augroup END + augroup! testing +endfunc + func Test_vim_did_enter() call assert_false(v:vim_did_enter) @@ -4152,4 +4159,23 @@ func Test_BufEnter_botline() set hidden&vim endfunc +" This was using freed memory +func Test_autocmd_BufWinLeave_with_vsp() + new + let fname = 'XXXBufWinLeaveUAF.txt' + let dummy = 'XXXDummy.txt' + call writefile([], fname) + call writefile([], dummy) + defer delete(fname) + defer delete(dummy) + exe "e " fname + vsp + augroup testing + exe "au BufWinLeave " .. fname .. " :e " dummy .. "| vsp " .. fname + augroup END + bw + call CleanUpTestAuGroup() + exe "bw! " .. dummy +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit