diff src/testdir/test_gui.vim @ 26743:c2c40cefc17b v8.2.3900

patch 8.2.3900: it is not easy to use a script-local function for an option Commit: https://github.com/vim/vim/commit/8bb65f230d3025037f34021a72616038da0601ee Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sun Dec 26 10:51:39 2021 +0000 patch 8.2.3900: it is not easy to use a script-local function for an option Problem: It is not easy to use a script-local function for an option. Solution: recognize s: and <SID> at the start of the expression. (Yegappan Lakshmanan, closes #9401)
author Bram Moolenaar <Bram@vim.org>
date Sun, 26 Dec 2021 12:00:04 +0100
parents be2d004247e1
children 722db0819111
line wrap: on
line diff
--- a/src/testdir/test_gui.vim
+++ b/src/testdir/test_gui.vim
@@ -258,6 +258,15 @@ func Test_set_balloonexpr()
   setl balloonexpr&
   call assert_equal('', &balloonexpr)
   delfunc MyBalloonExpr
+
+  " Using a script-local function
+  func s:NewBalloonExpr()
+  endfunc
+  set balloonexpr=s:NewBalloonExpr()
+  call assert_equal(expand('<SID>') .. 'NewBalloonExpr()', &balloonexpr)
+  set balloonexpr=<SID>NewBalloonExpr()
+  call assert_equal(expand('<SID>') .. 'NewBalloonExpr()', &balloonexpr)
+  delfunc s:NewBalloonExpr
   bwipe!
 
   " Multiline support