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 vim/vim#4374)
17aca707f9

Test_expand() changes are required for v8.1.1921.
Test_call() and Test_cindent_func() are already ported.
This commit is contained in:
Sean Dewar
2021-08-27 22:07:34 +01:00
parent 7ba11e06c0
commit 0193b3a391
7 changed files with 40 additions and 12 deletions

View File

@@ -56,6 +56,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()
@@ -999,6 +1000,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'))
@@ -1026,6 +1028,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()
@@ -1589,6 +1593,14 @@ func Test_call()
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
" Test for the eval() function
func Test_eval()
call assert_fails("call eval('5 a')", 'E488:')