diff src/testdir/test_functions.vim @ 16668:81be817c9d9a v8.1.1336

patch 8.1.1336: some eval functionality is not covered by tests commit https://github.com/vim/vim/commit/17aca707f92235b6f962e637e8073162d18e6de2 Author: Bram Moolenaar <Bram@vim.org> Date: Thu May 16 22:24:55 2019 +0200 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 https://github.com/vim/vim/issues/4374)
author Bram Moolenaar <Bram@vim.org>
date Thu, 16 May 2019 22:30:06 +0200
parents 0761a4c111a7
children e2d8d83e6721
line wrap: on
line diff
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -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