Mercurial > vim
comparison src/testdir/test_hardcopy.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 | 8fa9d31cd248 |
children |
comparison
equal
deleted
inserted
replaced
26742:00732e690ee8 | 26743:c2c40cefc17b |
---|---|
123 return 1 | 123 return 1 |
124 endfunc | 124 endfunc |
125 set printexpr=PrintFails(v:fname_in) | 125 set printexpr=PrintFails(v:fname_in) |
126 call assert_fails('hardcopy', 'E365:') | 126 call assert_fails('hardcopy', 'E365:') |
127 | 127 |
128 " Using a script-local function | |
129 func s:NewPrintExpr() | |
130 endfunc | |
131 set printexpr=s:NewPrintExpr() | |
132 call assert_equal(expand('<SID>') .. 'NewPrintExpr()', &printexpr) | |
133 set printexpr=<SID>NewPrintExpr() | |
134 call assert_equal(expand('<SID>') .. 'NewPrintExpr()', &printexpr) | |
135 | |
128 set printexpr& | 136 set printexpr& |
129 bwipe | 137 bwipe |
130 endfunc | 138 endfunc |
131 | 139 |
132 func Test_errors() | 140 func Test_errors() |