1
0
forked from aniani/vim

patch 8.2.2666: Vim9: not enough function arguments checked for string

Problem:    Vim9: not enough function arguments checked for string.
Solution:   Check in ch_logfile(), char2nr() and others.
This commit is contained in:
Bram Moolenaar
2021-03-27 21:23:30 +01:00
parent 7b45d46cf7
commit c580943965
6 changed files with 54 additions and 0 deletions

View File

@@ -204,14 +204,41 @@ def Test_call_call()
l->assert_equal([1, 2, 3])
enddef
def Test_ch_logfile()
assert_fails('ch_logfile(true)', 'E1174')
assert_fails('ch_logfile("foo", true)', 'E1174')
enddef
def Test_char2nr()
char2nr('あ', true)->assert_equal(12354)
assert_fails('char2nr(true)', 'E1174')
enddef
def Test_charclass()
assert_fails('charclass(true)', 'E1174')
enddef
def Test_chdir()
assert_fails('chdir(true)', 'E1174')
enddef
def Test_col()
new
setline(1, 'asdf')
col([1, '$'])->assert_equal(5)
assert_fails('col(true)', 'E1174')
enddef
def Test_confirm()
if !has('dialog_con') && !has('dialog_gui')
CheckFeature dialog_con
endif
assert_fails('call confirm(true)', 'E1174')
assert_fails('call confirm("yes", true)', 'E1174')
assert_fails('call confirm("yes", "maybe", 2, true)', 'E1174')
enddef
def Test_copy_return_type()
@@ -675,6 +702,10 @@ def Test_keys_return_type()
var->assert_equal(['a', 'b'])
enddef
def Test_line()
assert_fails('line(true)', 'E1174')
enddef
def Test_list2str_str2list_utf8()
var s = "\u3042\u3044"
var l = [0x3042, 0x3044]