]> granicus.if.org Git - vim/commitdiff
patch 8.2.2561: not all textprop code is covered by tests v8.2.2561
authorBram Moolenaar <Bram@vim.org>
Tue, 2 Mar 2021 12:36:47 +0000 (13:36 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 2 Mar 2021 12:36:47 +0000 (13:36 +0100)
Problem:    Not all textprop code is covered by tests.
Solution:   Add a few more test cases. (Dominique PellĂ©, closes #7908)

src/testdir/test_textprop.vim
src/version.c

index 469d9f77ddccd38fb5682a8790e7075c9f55c39f..cb17d5334ee5e1c566bd00ea53358f2fc6f2416f 100644 (file)
@@ -1338,6 +1338,25 @@ func Test_prop_func_invalid_args()
   call assert_fails("call prop_type_get([])", 'E730:')
   call assert_fails("call prop_type_get('', [])", 'E474:')
   call assert_fails("call prop_type_list([])", 'E715:')
+  call assert_fails("call prop_type_add('yyy', 'not_a_dict')", 'E715:')
+  call assert_fails("call prop_add(1, 5, {'type':'missing_type', 'length':1})", 'E971:')
+  call assert_fails("call prop_add(1, 5, {'type': ''})", 'E971:')
+  call assert_fails('call prop_add(1, 1, 0)', 'E715:')
+
+  new
+  call setline(1, ['first', 'second'])
+  call prop_type_add('xxx', {})
+
+  call assert_fails("call prop_type_add('xxx', {})", 'E969:')
+  call assert_fails("call prop_add(2, 0, {'type': 'xxx'})", 'E964:')
+  call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'end_lnum':1})", 'E475:')
+  call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'end_lnum':3})", 'E966:')
+  call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'length':-1})", 'E475:')
+  call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'end_col':0})", 'E475:')
+  call assert_fails("call prop_add(2, 3, {'length':1})", 'E965:')
+
+  call prop_type_delete('xxx')
+  bwipe!
 endfunc
 
 func Test_prop_split_join()
index 7f1e81872a0ba7e836703fb8a8431917de8084ba..17cb8d9309ee1fd80f6ca34e133424e1adcb9f4e 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2561,
 /**/
     2560,
 /**/