# HG changeset patch # User Bram Moolenaar # Date 1584627304 -3600 # Node ID 599793519c855a334458ce1c11206b03b15d369a # Parent 9aec979e8fdd31c8eedd438dc0f7912241128a19 patch 8.2.0409: search test leaves file behind Commit: https://github.com/vim/vim/commit/b68df220c5278365792b8f94d8d6f34d329b7746 Author: Bram Moolenaar Date: Thu Mar 19 15:05:28 2020 +0100 patch 8.2.0409: search test leaves file behind Problem: Search test leaves file behind. Solution: Delete the file. Also use Check commands. diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim --- a/src/testdir/test_search.vim +++ b/src/testdir/test_search.vim @@ -5,9 +5,8 @@ source screendump.vim source check.vim func Test_search_cmdline() - if !exists('+incsearch') - return - endif + CheckOption incsearch + " need to disable char_avail, " so that expansion of commandline works call test_override("char_avail", 1) @@ -202,9 +201,8 @@ func Test_search_cmdline() endfunc func Test_search_cmdline2() - if !exists('+incsearch') - return - endif + CheckOption incsearch + " need to disable char_avail, " so that expansion of commandline works call test_override("char_avail", 1) @@ -446,9 +444,8 @@ func Incsearch_cleanup() endfunc func Test_search_cmdline3() - if !exists('+incsearch') - return - endif + CheckOption incsearch + call Cmdline3_prep() 1 " first match @@ -459,9 +456,8 @@ func Test_search_cmdline3() endfunc func Test_search_cmdline3s() - if !exists('+incsearch') - return - endif + CheckOption incsearch + call Cmdline3_prep() 1 call feedkeys(":%s/the\/xxx\", 'tx') @@ -485,9 +481,8 @@ func Test_search_cmdline3s() endfunc func Test_search_cmdline3g() - if !exists('+incsearch') - return - endif + CheckOption incsearch + call Cmdline3_prep() 1 call feedkeys(":g/the\/d\", 'tx') @@ -508,9 +503,8 @@ func Test_search_cmdline3g() endfunc func Test_search_cmdline3v() - if !exists('+incsearch') - return - endif + CheckOption incsearch + call Cmdline3_prep() 1 call feedkeys(":v/the\/d\", 'tx') @@ -525,9 +519,8 @@ func Test_search_cmdline3v() endfunc func Test_search_cmdline4() - if !exists('+incsearch') - return - endif + CheckOption incsearch + " need to disable char_avail, " so that expansion of commandline works call test_override("char_avail", 1) @@ -559,9 +552,8 @@ func Test_search_cmdline4() endfunc func Test_search_cmdline5() - if !exists('+incsearch') - return - endif + CheckOption incsearch + " Do not call test_override("char_avail", 1) so that and work " regardless char_avail. new @@ -581,9 +573,8 @@ endfunc func Test_search_cmdline6() " Test that consecutive matches " are caught by / - if !exists('+incsearch') - return - endif + CheckOption incsearch + " need to disable char_avail, " so that expansion of commandline works call test_override("char_avail", 1) @@ -621,9 +612,8 @@ endfunc func Test_search_cmdline7() " Test that an pressing in an empty command line " does not move the cursor - if !exists('+incsearch') - return - endif + CheckOption incsearch + " need to disable char_avail, " so that expansion of commandline works call test_override("char_avail", 1) @@ -754,9 +744,8 @@ func Test_search_regexp() endfunc func Test_search_cmdline_incsearch_highlight() - if !exists('+incsearch') - return - endif + CheckOption incsearch + set incsearch hlsearch " need to disable char_avail, " so that expansion of commandline works @@ -874,9 +863,8 @@ func Test_search_cmdline_incsearch_highl endfunc func Test_incsearch_cmdline_modifier() - if !exists('+incsearch') - return - endif + CheckOption incsearch + call test_override("char_avail", 1) new call setline(1, ['foo']) @@ -918,12 +906,9 @@ func Test_incsearch_scrolling() endfunc func Test_incsearch_search_dump() - if !exists('+incsearch') - return - endif - if !CanRunVimInTerminal() - throw 'Skipped: cannot make screendumps' - endif + CheckOption incsearch + CheckScreendump + call writefile([ \ 'set incsearch hlsearch scrolloff=0', \ 'for n in range(1, 8)', @@ -951,9 +936,8 @@ func Test_incsearch_search_dump() endfunc func Test_incsearch_substitute() - if !exists('+incsearch') - return - endif + CheckOption incsearch + call test_override("char_avail", 1) new set incsearch @@ -973,12 +957,9 @@ endfunc " Similar to Test_incsearch_substitute() but with a screendump halfway. func Test_incsearch_substitute_dump() - if !exists('+incsearch') - return - endif - if !CanRunVimInTerminal() - throw 'Skipped: cannot make screendumps' - endif + CheckOption incsearch + CheckScreendump + call writefile([ \ 'set incsearch hlsearch scrolloff=0', \ 'for n in range(1, 10)', @@ -1085,12 +1066,8 @@ func Test_incsearch_substitute_dump() endfunc func Test_incsearch_highlighting() - if !exists('+incsearch') - return - endif - if !CanRunVimInTerminal() - throw 'Skipped: cannot make screendumps' - endif + CheckOption incsearch + CheckScreendump call writefile([ \ 'set incsearch hlsearch', @@ -1106,12 +1083,15 @@ func Test_incsearch_highlighting() call term_sendkeys(buf, ":%s;ello/the") call VerifyScreenDump(buf, 'Test_incsearch_substitute_15', {}) call term_sendkeys(buf, "") + + call StopVimInTerminal(buf) + call delete('Xis_subst_hl_script') endfunc func Test_incsearch_with_change() - if !has('timers') || !exists('+incsearch') || !CanRunVimInTerminal() - throw 'Skipped: cannot make screendumps and/or timers feature and/or incsearch option missing' - endif + CheckFeature timers + CheckOption incsearch + CheckScreendump call writefile([ \ 'set incsearch hlsearch scrolloff=0', @@ -1134,12 +1114,9 @@ endfunc " Similar to Test_incsearch_substitute_dump() for :sort func Test_incsearch_sort_dump() - if !exists('+incsearch') - return - endif - if !CanRunVimInTerminal() - throw 'Skipped: cannot make screendumps' - endif + CheckOption incsearch + CheckScreendump + call writefile([ \ 'set incsearch hlsearch scrolloff=0', \ 'call setline(1, ["another one 2", "that one 3", "the one 1"])', @@ -1160,12 +1137,9 @@ endfunc " Similar to Test_incsearch_substitute_dump() for :vimgrep famiry func Test_incsearch_vimgrep_dump() - if !exists('+incsearch') - return - endif - if !CanRunVimInTerminal() - throw 'Skipped: cannot make screendumps' - endif + CheckOption incsearch + CheckScreendump + call writefile([ \ 'set incsearch hlsearch scrolloff=0', \ 'call setline(1, ["another one 2", "that one 3", "the one 1"])', @@ -1201,9 +1175,8 @@ func Test_incsearch_vimgrep_dump() endfunc func Test_keep_last_search_pattern() - if !exists('+incsearch') - return - endif + CheckOption incsearch + new call setline(1, ['foo', 'foo', 'foo']) set incsearch @@ -1222,9 +1195,8 @@ func Test_keep_last_search_pattern() endfunc func Test_word_under_cursor_after_match() - if !exists('+incsearch') - return - endif + CheckOption incsearch + new call setline(1, 'foo bar') set incsearch @@ -1241,9 +1213,8 @@ func Test_word_under_cursor_after_match( endfunc func Test_subst_word_under_cursor() - if !exists('+incsearch') - return - endif + CheckOption incsearch + new call setline(1, ['int SomeLongName;', 'for (xxx = 1; xxx < len; ++xxx)']) set incsearch @@ -1258,9 +1229,8 @@ func Test_subst_word_under_cursor() endfunc func Test_search_undefined_behaviour() - if !has("terminal") - return - endif + CheckFeature terminal + let h = winheight(0) if h < 3 return @@ -1326,9 +1296,8 @@ func Test_search_Ctrl_L_combining() " ' ̇' U+0307 Dec:775 COMBINING DOT ABOVE ̇ /\%u307\Z "\u0307" " ' ̣' U+0323 Dec:803 COMBINING DOT BELOW ̣ /\%u323 "\u0323" " Those should also appear on the commandline - if !exists('+incsearch') - return - endif + CheckOption incsearch + call Cmdline3_prep() 1 let bufcontent = ['', 'Miạ̀́̇m'] @@ -1377,9 +1346,8 @@ func Test_one_error_msg() endfunc func Test_incsearch_add_char_under_cursor() - if !exists('+incsearch') - return - endif + CheckOption incsearch + set incsearch new call setline(1, ['find match', 'anything']) diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -739,6 +739,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 409, +/**/ 408, /**/ 407,