]> granicus.if.org Git - vim/commitdiff
patch 8.2.3982: some lines of code not covered by tests v8.2.3982
authorDominique Pelle <dominique.pelle@gmail.com>
Sun, 2 Jan 2022 16:16:33 +0000 (16:16 +0000)
committerBram Moolenaar <Bram@vim.org>
Sun, 2 Jan 2022 16:16:33 +0000 (16:16 +0000)
Problem:    Some lines of code not covered by tests.
Solution:   Add a few more test cases. (Dominique Pellé, closes #9453)

src/testdir/test_filter_map.vim
src/testdir/test_highlight.vim
src/testdir/test_regexp_latin.vim
src/testdir/test_search.vim
src/testdir/test_vim9_builtin.vim
src/version.c

index 6cde453500952856ed9f3012d9e5569f5b1b1560..072e7cb7ba51cc5a4819c5f086c8c159dfe9d22e 100644 (file)
@@ -151,7 +151,7 @@ func Test_filter_map_string()
   let lines =<< trim END
     VAR s = "abc"
     call filter(s, '"b" != v:val')
-    call assert_equal(s, s)
+    call assert_equal('abc', s)
     call assert_equal('ac', filter('abc', '"b" != v:val'))
     call assert_equal('あいうえお', filter('あxいxうxえxお', '"x" != v:val'))
     call assert_equal('あa😊💕💕b💕', filter('あxax😊x💕💕b💕x', '"x" != v:val'))
@@ -172,7 +172,7 @@ func Test_filter_map_string()
   let lines =<< trim END
     VAR s = "abc"
     call map(s, 'nr2char(char2nr(v:val) + 2)')
-    call assert_equal(s, s)
+    call assert_equal('abc', s)
     call assert_equal('cde', map('abc', 'nr2char(char2nr(v:val) + 2)'))
     call assert_equal('[あ][i][う][え][お]', map('あiうえお', '"[" .. v:val .. "]"'))
     call assert_equal('[あ][a][😊][,][‱][‼][⁇][⁈][⁉][💕][b][💕][c][💕]', map('あa😊,‱‼⁇⁈⁉💕b💕c💕', '"[" .. v:val .. "]"'))
@@ -191,7 +191,7 @@ func Test_filter_map_string()
   let lines =<< trim END
     VAR s = "abc"
     call mapnew(s, 'nr2char(char2nr(v:val) + 2)')
-    call assert_equal(s, s)
+    call assert_equal('abc', s)
     call assert_equal('cde', mapnew('abc', 'nr2char(char2nr(v:val) + 2)'))
     call assert_equal('[あ][i][う][え][お]', mapnew('あiうえお', '"[" .. v:val .. "]"'))
     call assert_equal('[あ][a][😊][,][‱][‼][⁇][⁈][⁉][💕][b][💕][c][💕]', mapnew('あa😊,‱‼⁇⁈⁉💕b💕c💕', '"[" .. v:val .. "]"'))
index 001cd39dbd8628bcffdec602eec8d8f9a22d5644..5476008c4e54e31e48a45deca6f8d07249bfb337 100644 (file)
@@ -922,17 +922,20 @@ func Test_highlight_default_colorscheme_restores_links()
   let hlTestHiPre = HighlightArgs('TestHi')
 
   " Test colorscheme
+  call assert_equal("\ndefault", execute('colorscheme'))
   hi clear
   if exists('syntax_on')
     syntax reset
   endif
   let g:colors_name = 'test'
+  call assert_equal("\ntest", execute('colorscheme'))
   hi link TestLink ErrorMsg
   hi TestHi ctermbg=green
 
   " Restore default highlighting
   colorscheme default
   " 'default' should work no matter if highlight group was cleared
+  call assert_equal("\ndefault", execute('colorscheme'))
   hi def link TestLink Identifier
   hi def TestHi ctermbg=red
   let hlTestLinkPost = HighlightArgs('TestLink')
index f936549e7aab8b50000d1f91a6e8e6a0784d4fce..166488b5384aa3fd8638b91bcdf3617e52933c9e 100644 (file)
@@ -6,7 +6,10 @@ scriptencoding latin1
 source check.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ñ oòóôõöø p q r s t uùúûü v w x yýÿ z"
+  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ñ oòóôõöø p q r s t uùúûü v w x yýÿ z '
+  \      .. "0 1 2 3 4 5 6 7 8 9 "
+  \      .. "` ~ ! ? ; : . , / \\ ' \" | < > [ ] { } ( ) @ # $ % ^ & * _ - + \b \e \f \n \r \t"
   let groups = split(str)
   for group1 in groups
       for c in split(group1, '\zs')
index eaf9c232691386a48dd1072fa8b9fdd406138ed6..f790c84557a888a16f8e9caf6b1f10a3a6def81a 100644 (file)
@@ -1682,6 +1682,8 @@ func Test_invalid_regexp()
   call assert_fails("call search('\\(')", 'E54:')
   call assert_fails("call search('\\)')", 'E55:')
   call assert_fails("call search('\\z\\(\\)')", 'E66:')
+  call assert_fails("call search('\\z2')", 'E67:')
+  call assert_fails("call search('\\zx')", 'E867:')
   call assert_fails("call search('\\%[ab')", 'E69:')
   call assert_fails("call search('\\%[]')", 'E70:')
   call assert_fails("call search('\\%9999999999999999999999999999v')", 'E951:')
index df9e8ec105597dd9fe01906b33783b74c6ceaf46..2ee1a93442ab3ea4bd6079767c70d8b9862d4ef7 100644 (file)
@@ -956,6 +956,8 @@ def Test_expandcmd()
 
   assert_equal("yes", expandcmd("`={a: 'yes'}['a']`"))
   expandcmd('')->assert_equal('')
+
+  CheckDefAndScriptFailure(['expandcmd([1])'], ['E1013: Argument 1: type mismatch, expected string but got list<number>', 'E1174: String required for argument 1'])
 enddef
 
 def Test_extend_arg_types()
index 521fe3978023d6db947b78771f6f18d4f07602fb..f4d31726a45674e84047d10feda7dae6ddeae163 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3982,
 /**/
     3981,
 /**/