diff src/testdir/test_normal.vim @ 26721:9c9b8d95b05f v8.2.3889

patch 8.2.3889: duplicate code for translating script-local function name Commit: https://github.com/vim/vim/commit/e7f4abd38b6e05100c699900c8f87281e363beb2 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Fri Dec 24 20:47:38 2021 +0000 patch 8.2.3889: duplicate code for translating script-local function name Problem: Duplicate code for translating script-local function name. Solution: Move the code to get_scriptlocal_funcname(). (Yegappan Lakshmanan, closes #9393)
author Bram Moolenaar <Bram@vim.org>
date Fri, 24 Dec 2021 22:00:03 +0100
parents b531c26f728b
children c2c40cefc17b
line wrap: on
line diff
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -642,6 +642,18 @@ func Test_opfunc_callback()
   END
   call CheckScriptSuccess(lines)
 
+  " setting 'opfunc' to a script local function outside of a script context
+  " should fail
+  let cleanup =<< trim END
+    call writefile([execute('messages')], 'Xtest.out')
+    qall
+  END
+  call writefile(cleanup, 'Xverify.vim')
+  call RunVim([], [], "-c \"set opfunc=s:abc\" -S Xverify.vim")
+  call assert_match('E81: Using <SID> not in a', readfile('Xtest.out')[0])
+  call delete('Xtest.out')
+  call delete('Xverify.vim')
+
   " cleanup
   set opfunc&
   delfunc OpFunc1