patch 8.2.3415: Vim9: not all function argument types are properly checked
Problem: Vim9: Not all function argument types are properly checked.
Solution: Add and improve argument type checks. (Yegappan Lakshmanan,
closes #8839)
diff --git a/src/testdir/test_digraph.vim b/src/testdir/test_digraph.vim
index 5f924aa..9cb946c 100644
--- a/src/testdir/test_digraph.vim
+++ b/src/testdir/test_digraph.vim
@@ -536,6 +536,8 @@
call assert_fails('call digraph_set("あ", "あ")', 'E1214: Digraph must be just two characters: あ')
call assert_fails('call digraph_set("aa", "ああ")', 'E1215: Digraph must be one character: ああ')
call assert_fails('call digraph_set("aa", "か" .. nr2char(0x3099))', 'E1215: Digraph must be one character: か' .. nr2char(0x3099))
+ call assert_fails('call digraph_set(test_null_string(), "い")', 'E1214: Digraph must be just two characters')
+ call assert_fails('call digraph_set("aa", 0z10)', 'E976: Using a Blob as a String')
bwipe!
endfunc
@@ -553,6 +555,8 @@
call assert_equal('う', digraph_get(' '))
call assert_fails('call digraph_get("aaa")', 'E1214: Digraph must be just two characters: aaa')
call assert_fails('call digraph_get("b")', 'E1214: Digraph must be just two characters: b')
+ call assert_fails('call digraph_get(test_null_string())', 'E1214: Digraph must be just two characters:')
+ call assert_fails('call digraph_get(0z10)', 'E976: Using a Blob as a String')
endfunc
func Test_digraph_get_function_encode()
@@ -576,8 +580,12 @@
call assert_equal('く', digraph_get('bb'))
call assert_fails('call digraph_setlist([[]])', 'E1216:')
- call assert_fails('call digraph_setlist([["aa", "b", "cc"]])', '1216:')
+ call assert_fails('call digraph_setlist([["aa", "b", "cc"]])', 'E1216:')
call assert_fails('call digraph_setlist([["あ", "あ"]])', 'E1214: Digraph must be just two characters: あ')
+ call assert_fails('call digraph_setlist([test_null_list()])', 'E1216:')
+ call assert_fails('call digraph_setlist({})', 'E1216:')
+ call assert_fails('call digraph_setlist([{}])', 'E1216:')
+ call assert_true(digraph_setlist(test_null_list()))
endfunc
func Test_digraph_getlist_function()
@@ -592,6 +600,8 @@
" of digraphs returned.
call assert_equal(digraph_getlist()->len(), digraph_getlist(0)->len())
call assert_notequal((digraph_getlist()->len()), digraph_getlist(1)->len())
+
+ call assert_fails('call digraph_getlist(0z12)', 'E974: Using a Blob as a Number')
endfunc