• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revision595ea7f099cd511a7bd895889c50af2642f5a8b0 (tree)
Time2020-09-24 05:45:06
AuthorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.2.1736: failure to compile a pattern not tested much

Commit: https://github.com/vim/vim/commit/531be47ac5522807b265c6287021a01c9b895ac9
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Sep 23 22:38:05 2020 +0200

patch 8.2.1736: failure to compile a pattern not tested much
Problem: Failure to compile a pattern not tested much.
Solution: Add tests where a pattern fails to compile. (Yegappan Lakshmanan,
closes #7004)

Change Summary

Incremental Difference

diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/gen_opt_test.vim
--- a/src/testdir/gen_opt_test.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/gen_opt_test.vim Wed Sep 23 22:45:06 2020 +0200
@@ -73,7 +73,7 @@
7373 \ 'buftype': [['', 'help', 'nofile'], ['xxx', 'help,nofile']],
7474 \ 'casemap': [['', 'internal'], ['xxx']],
7575 \ 'cedit': [['', '\<Esc>'], ['xxx', 'f']],
76- \ 'clipboard': [['', 'unnamed', 'autoselect,unnamed', 'html', 'exclude:vimdisplay'], ['xxx', '\ze*']],
76+ \ 'clipboard': [['', 'unnamed', 'autoselect,unnamed', 'html', 'exclude:vimdisplay'], ['xxx', '\ze*', 'exclude:\\%(']],
7777 \ 'colorcolumn': [['', '8', '+2'], ['xxx']],
7878 \ 'comments': [['', 'b:#'], ['xxx']],
7979 \ 'commentstring': [['', '/*%s*/'], ['xxx']],
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_arglist.vim
--- a/src/testdir/test_arglist.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_arglist.vim Wed Sep 23 22:45:06 2020 +0200
@@ -425,6 +425,7 @@
425425 call assert_equal(['b'], argv())
426426 call assert_fails('argdelete', 'E610:')
427427 call assert_fails('1,100argdelete', 'E16:')
428+ call assert_fails('argdel /\)/', 'E55:')
428429
429430 call Reset_arglist()
430431 args a b c d
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_autocmd.vim
--- a/src/testdir/test_autocmd.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_autocmd.vim Wed Sep 23 22:45:06 2020 +0200
@@ -2520,6 +2520,7 @@
25202520 call assert_fails('doautocmd * BufEnter', 'E217:')
25212521 call assert_fails('augroup! x1a2b3', 'E367:')
25222522 call assert_fails('autocmd BufNew <buffer=999> pwd', 'E680:')
2523+ call assert_fails('autocmd BufNew \) set ff=unix', 'E55:')
25232524 endfunc
25242525
25252526 " Test for deep nesting of autocmds
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_buffer.vim
--- a/src/testdir/test_buffer.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_buffer.vim Wed Sep 23 22:45:06 2020 +0200
@@ -138,6 +138,7 @@
138138 %bwipe!
139139 call assert_fails('bdelete 5', 'E516:')
140140 call assert_fails('1,1bdelete 1 2', 'E488:')
141+ call assert_fails('bdelete \)', 'E55:')
141142
142143 " Deleting a unlisted and unloaded buffer
143144 edit Xfile1
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_checkpath.vim
--- a/src/testdir/test_checkpath.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_checkpath.vim Wed Sep 23 22:45:06 2020 +0200
@@ -103,4 +103,19 @@
103103 set includeexpr&
104104 endfunc
105105
106+" Test for invalid regex in 'include' and 'define' options
107+func Test_checkpath_errors()
108+ let save_include = &include
109+ set include=\\%(
110+ call assert_fails('checkpath', 'E53:')
111+ let &include = save_include
112+
113+ let save_define = &define
114+ set define=\\%(
115+ call assert_fails('dsearch abc', 'E53:')
116+ let &define = save_define
117+
118+ call assert_fails('psearch \%(', 'E53:')
119+endfunc
120+
106121 " vim: shiftwidth=2 sts=2 expandtab
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_cmdline.vim
--- a/src/testdir/test_cmdline.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_cmdline.vim Wed Sep 23 22:45:06 2020 +0200
@@ -185,6 +185,8 @@
185185 unmap <Left>
186186 set cpo-=k
187187
188+ call assert_fails('call feedkeys(":map \\\\%(\<Tab>\<Home>\"\<CR>", "xt")', 'E53:')
189+
188190 unmap <Middle>x
189191 set cpo&vim
190192 endfunc
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_debugger.vim
--- a/src/testdir/test_debugger.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_debugger.vim Wed Sep 23 22:45:06 2020 +0200
@@ -339,6 +339,7 @@
339339 call delete('Xtest.vim')
340340 %bw!
341341 call assert_fails('breakadd here', 'E32:')
342+ call assert_fails('breakadd file Xtest.vim /\)/', 'E55:')
342343 endfunc
343344
344345 func Test_Backtrace_Through_Source()
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_functions.vim
--- a/src/testdir/test_functions.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_functions.vim Wed Sep 23 22:45:06 2020 +0200
@@ -973,6 +973,7 @@
973973 call assert_equal(4, match('testing', 'ing', -1))
974974 call assert_fails("let x=match('testing', 'ing', 0, [])", 'E745:')
975975 call assert_equal(-1, match(test_null_list(), 2))
976+ call assert_equal(-1, match('abc', '\\%('))
976977 endfunc
977978
978979 func Test_matchend()
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_history.vim
--- a/src/testdir/test_history.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_history.vim Wed Sep 23 22:45:06 2020 +0200
@@ -95,6 +95,7 @@
9595 call assert_fails('call histnr([])', 'E730:')
9696 call assert_fails('history xyz', 'E488:')
9797 call assert_fails('history ,abc', 'E488:')
98+ call assert_fails('call histdel(":", "\\%(")', 'E53:')
9899 endfunction
99100
100101 function Test_Search_history_window()
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_listdict.vim
--- a/src/testdir/test_listdict.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_listdict.vim Wed Sep 23 22:45:06 2020 +0200
@@ -753,6 +753,7 @@
753753 call assert_equal(['', 'a', '', 'b', '', 'c', ''], split('abc', '\zs', 1))
754754 call assert_fails("call split('abc', [])", 'E730:')
755755 call assert_fails("call split('abc', 'b', [])", 'E745:')
756+ call assert_equal(['abc'], split('abc', '\\%('))
756757 endfunc
757758
758759 " compare recursively linked list and dict
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_options.vim
--- a/src/testdir/test_options.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_options.vim Wed Sep 23 22:45:06 2020 +0200
@@ -411,6 +411,7 @@
411411 call assert_fails('set pyxversion=6', 'E474:')
412412 endif
413413 call assert_fails("let &tabstop='ab'", 'E521:')
414+ call assert_fails('set spellcapcheck=%\\(', 'E54:')
414415 endfunc
415416
416417 func CheckWasSet(name)
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_search_stat.vim
--- a/src/testdir/test_search_stat.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_search_stat.vim Wed Sep 23 22:45:06 2020 +0200
@@ -260,6 +260,14 @@
260260
261261 func Test_searchcount_fails()
262262 call assert_fails('echo searchcount("boo!")', 'E715:')
263+ call assert_fails('echo searchcount({"timeout" : []})', 'E745:')
264+ call assert_fails('echo searchcount({"maxcount" : []})', 'E745:')
265+ call assert_fails('echo searchcount({"pattern" : []})', 'E730:')
266+ call assert_fails('echo searchcount({"pos" : 1})', 'E475:')
267+ call assert_fails('echo searchcount({"pos" : [1]})', 'E475:')
268+ call assert_fails('echo searchcount({"pos" : [[], 2, 3]})', 'E745:')
269+ call assert_fails('echo searchcount({"pos" : [1, [], 3]})', 'E745:')
270+ call assert_fails('echo searchcount({"pos" : [1, 2, []]})', 'E745:')
263271 endfunc
264272
265273 func Test_searchcount_in_statusline()
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_sort.vim
--- a/src/testdir/test_sort.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_sort.vim Wed Sep 23 22:45:06 2020 +0200
@@ -1256,6 +1256,7 @@
12561256 call assert_fails('sort no', 'E474:')
12571257 call assert_fails('sort c', 'E475:')
12581258 call assert_fails('sort #pat%', 'E654:')
1259+ call assert_fails('sort /\%(/', 'E53:')
12591260
12601261 enew!
12611262 endfunc
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_substitute.vim
--- a/src/testdir/test_substitute.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_substitute.vim Wed Sep 23 22:45:06 2020 +0200
@@ -246,6 +246,7 @@
246246 call assert_fails("let s=substitute('abcda', [], 'A', 'g')", 'E730:')
247247 call assert_fails("let s=substitute('abcda', 'a', [], 'g')", 'E730:')
248248 call assert_fails("let s=substitute('abcda', 'a', 'A', [])", 'E730:')
249+ call assert_fails("let s=substitute('abc', '\\%(', 'A', 'g')", 'E53:')
249250
250251 bwipe!
251252 endfunc
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_syntax.vim
--- a/src/testdir/test_syntax.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_syntax.vim Wed Sep 23 22:45:06 2020 +0200
@@ -373,6 +373,7 @@
373373 call AssertFails('syntax cluster contains=Abc', 'E400:')
374374 call AssertFails("syntax match Character /'.'", 'E401:')
375375 call AssertFails("syntax match Character /'.'/a", 'E402:')
376+ call assert_fails('syntax sync linecont /\%(/', 'E53:')
376377 call assert_fails('syntax sync linecont /pat', 'E404:')
377378 call assert_fails('syntax sync linecont', 'E404:')
378379 call assert_fails('syntax sync linecont /pat1/ linecont /pat2/', 'E403:')
@@ -382,6 +383,7 @@
382383 call AssertFails('syntax match ccFoo "Foo" nextgroup=ALLBUT,F', 'E407:')
383384 call AssertFails('syntax region Block start="{" contains=F,ALLBUT', 'E408:')
384385 call AssertFails("syntax match Characters contains=a.*x /'.'/", 'E409:')
386+ call assert_fails('syntax match Search /abc/ contains=ALLBUT,/\%(/', 'E53:')
385387 endfunc
386388
387389 func Test_syn_sync()
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_tagjump.vim
--- a/src/testdir/test_tagjump.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_tagjump.vim Wed Sep 23 22:45:06 2020 +0200
@@ -184,6 +184,10 @@
184184 call search("start")
185185 exe "normal! 5\<C-W>\<C-I>"
186186 call assert_equal(" start OK if found this line", getline('.'))
187+
188+ " invalid tag search pattern
189+ call assert_fails('tag /\%(/', 'E426:')
190+
187191 enew! | only
188192 call delete('Xtestfile')
189193 call delete('Xinclude')
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/testdir/test_user_func.vim
--- a/src/testdir/test_user_func.vim Wed Sep 23 22:30:04 2020 +0200
+++ b/src/testdir/test_user_func.vim Wed Sep 23 22:45:06 2020 +0200
@@ -410,6 +410,9 @@
410410 call writefile(['func foo#Bar()', 'return 1', 'endfunc'], 'Xscript')
411411 call assert_fails('source Xscript', 'E746:')
412412 call delete('Xscript')
413+
414+ " Try to list functions using an invalid search pattern
415+ call assert_fails('function /\%(/', 'E53:')
413416 endfunc
414417
415418 " Test for deleting a function
diff -r e9b3a8c9ae2c -r 595ea7f099cd src/version.c
--- a/src/version.c Wed Sep 23 22:30:04 2020 +0200
+++ b/src/version.c Wed Sep 23 22:45:06 2020 +0200
@@ -751,6 +751,8 @@
751751 static int included_patches[] =
752752 { /* Add new patch number below this line */
753753 /**/
754+ 1736,
755+/**/
754756 1735,
755757 /**/
756758 1734,
Show on old repository browser