diff src/testdir/test_vim9_builtin.vim @ 25236:2c83f7b316d3 v8.2.3154

patch 8.2.3154: Vim9: some type checks for builtin functions fail Commit: https://github.com/vim/vim/commit/841e498c5d1765eab17bce5242543b47dfc25b41 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sun Jul 11 22:04:25 2021 +0200 patch 8.2.3154: Vim9: some type checks for builtin functions fail Problem: Vim9: some type checks for builtin functions fail. Solution: Correct the type checks. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/8551, closes #8550)
author Bram Moolenaar <Bram@vim.org>
date Sun, 11 Jul 2021 22:15:04 +0200
parents a703b3f28ef4
children a7f2a2079bce
line wrap: on
line diff
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -1523,6 +1523,12 @@ enddef
 def Test_popup_atcursor()
   CheckDefAndScriptFailure2(['popup_atcursor({"a": 10}, {})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E450: buffer number, text or a list required')
   CheckDefAndScriptFailure2(['popup_atcursor("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
+
+  # Pass variable of type 'any' to popup_atcursor()
+  var what: any = 'Hello'
+  var popupID = what->popup_atcursor({moved: 'any'})
+  assert_equal(0, popupID->popup_getoptions().tabpage)
+  popupID->popup_close()
 enddef
 
 def Test_popup_beval()
@@ -1530,6 +1536,14 @@ def Test_popup_beval()
   CheckDefAndScriptFailure2(['popup_beval("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
 enddef
 
+def Test_popup_create()
+  # Pass variable of type 'any' to popup_create()
+  var what: any = 'Hello'
+  var popupID = what->popup_create({})
+  assert_equal(0, popupID->popup_getoptions().tabpage)
+  popupID->popup_close()
+enddef
+
 def Test_popup_dialog()
   CheckDefAndScriptFailure2(['popup_dialog({"a": 10}, {})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E450: buffer number, text or a list required')
   CheckDefAndScriptFailure2(['popup_dialog("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
@@ -2358,6 +2372,7 @@ def Test_virtcol()
   setline(1, ['abcdefgh'])
   cursor(1, 4)
   assert_equal(4, virtcol('.'))
+  assert_equal(4, virtcol([1, 4]))
   assert_equal(9, virtcol([1, '$']))
   assert_equal(0, virtcol([10, '$']))
   bw!