forked from aniani/vim
patch 8.1.1336: some eval functionality is not covered by tests
Problem: Some eval functionality is not covered by tests. Solution: Add a few more test cases. (Masato Nishihata, closes #4374)
This commit is contained in:
@@ -52,6 +52,7 @@ func Test_empty()
|
||||
endif
|
||||
|
||||
call assert_equal(0, empty(function('Test_empty')))
|
||||
call assert_equal(0, empty(function('Test_empty', [0])))
|
||||
endfunc
|
||||
|
||||
func Test_len()
|
||||
@@ -869,6 +870,7 @@ func Test_count()
|
||||
call assert_equal(1, count(l, 'a', 0, 1))
|
||||
call assert_equal(2, count(l, 'a', 1, 1))
|
||||
call assert_fails('call count(l, "a", 0, 10)', 'E684:')
|
||||
call assert_fails('call count(l, "a", [])', 'E745:')
|
||||
|
||||
let d = {1: 'a', 2: 'a', 3: 'A', 4: 'b'}
|
||||
call assert_equal(2, count(d, 'a'))
|
||||
@@ -896,6 +898,8 @@ func Test_count()
|
||||
call assert_equal(2, count("foo", "O", 1))
|
||||
call assert_equal(2, count("fooooo", "oo"))
|
||||
call assert_equal(0, count("foo", ""))
|
||||
|
||||
call assert_fails('call count(0, 0)', 'E712:')
|
||||
endfunc
|
||||
|
||||
func Test_changenr()
|
||||
@@ -1431,3 +1435,23 @@ func Test_readdir()
|
||||
|
||||
call delete('Xdir', 'rf')
|
||||
endfunc
|
||||
|
||||
func Test_call()
|
||||
call assert_equal(3, call('len', [123]))
|
||||
call assert_fails("call call('len', 123)", 'E714:')
|
||||
call assert_equal(0, call('', []))
|
||||
|
||||
function Mylen() dict
|
||||
return len(self.data)
|
||||
endfunction
|
||||
let mydict = {'data': [0, 1, 2, 3], 'len': function("Mylen")}
|
||||
call assert_fails("call call('Mylen', [], 0)", 'E715:')
|
||||
endfunc
|
||||
|
||||
func Test_char2nr()
|
||||
call assert_equal(12354, char2nr('あ', 1))
|
||||
endfunc
|
||||
|
||||
func Test_eventhandler()
|
||||
call assert_equal(0, eventhandler())
|
||||
endfunc
|
||||
|
Reference in New Issue
Block a user