diff src/testdir/test_textprop.vim @ 20178:2fb397573541

patch 8.2.0644: insufficient testing for invalid function arguments Commit: https://github.com/vim/vim/commit/99fa721944dda9d07c53c907c33466728df5c271 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 26 15:59:55 2020 +0200 patch 8.2.0644: insufficient testing for invalid function arguments Problem: Insufficient testing for invalid function arguments. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5988)
author Bram Moolenaar <Bram@vim.org>
date Sun, 26 Apr 2020 16:00:04 +0200
parents 647ef636a11e
children d067be761cd7
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -1204,3 +1204,28 @@ func Test_find_zerowidth_prop_sol()
   bwipe!
   call prop_type_delete('test')
 endfunc
+
+" Test for passing invalid arguments to prop_xxx() functions
+func Test_prop_func_invalid_args()
+  call assert_fails('call prop_clear(1, 2, [])', 'E715:')
+  call assert_fails('call prop_clear(-1, 2)', 'E16:')
+  call assert_fails('call prop_find(test_null_dict())', 'E474:')
+  call assert_fails('call prop_find({"bufnr" : []})', 'E158:')
+  call assert_fails('call prop_find({})', 'E968:')
+  call assert_fails('call prop_find({}, "x")', 'E474:')
+  call assert_fails('call prop_find({"lnum" : -2})', 'E16:')
+  call assert_fails('call prop_list(1, [])', 'E715:')
+  call assert_fails('call prop_list(-1 , {})', 'E16:')
+  call assert_fails('call prop_remove([])', 'E474:')
+  call assert_fails('call prop_remove({}, -2)', 'E16:')
+  call assert_fails('call prop_remove({})', 'E968:')
+  call assert_fails('call prop_type_add([], {})', 'E474:')
+  call assert_fails("call prop_type_change('long', {'xyz' : 10})", 'E971:')
+  call assert_fails("call prop_type_delete([])", 'E474:')
+  call assert_fails("call prop_type_delete('xyz', [])", 'E715:')
+  call assert_fails("call prop_type_get([])", 'E474:')
+  call assert_fails("call prop_type_get('', [])", 'E474:')
+  call assert_fails("call prop_type_list([])", 'E715:')
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab