Mercurial > vim
comparison src/testdir/test_iminsert.vim @ 26452:65b4109a4297 v8.2.3756
patch 8.2.3756: might crash when callback is not valid
Commit: https://github.com/vim/vim/commit/4dc24eb5adbcc76838fae1e900936dd230209d96
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Tue Dec 7 12:23:57 2021 +0000
patch 8.2.3756: might crash when callback is not valid
Problem: might crash when callback is not valid.
Solution: Check for valid callback. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/9293)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 07 Dec 2021 13:30:05 +0100 |
parents | 65ab0b035dd8 |
children | 13ba00ef7687 |
comparison
equal
deleted
inserted
replaced
26451:27720705109b | 26452:65b4109a4297 |
---|---|
255 call assert_fails('normal! i', 'E117:') | 255 call assert_fails('normal! i', 'E117:') |
256 set imactivatefunc=IMactivatefunc1 | 256 set imactivatefunc=IMactivatefunc1 |
257 set imstatusfunc=()\ =>\ IMstatusfunc1(a) | 257 set imstatusfunc=()\ =>\ IMstatusfunc1(a) |
258 call assert_fails('normal! i', 'E117:') | 258 call assert_fails('normal! i', 'E117:') |
259 | 259 |
260 " set 'imactivatefunc' and 'imstatusfunc' to a non-existing function | |
261 set imactivatefunc=IMactivatefunc1 | |
262 set imstatusfunc=IMstatusfunc1 | |
263 call assert_fails("set imactivatefunc=function('NonExistingFunc')", 'E700:') | |
264 call assert_fails("set imstatusfunc=function('NonExistingFunc')", 'E700:') | |
265 call assert_fails("let &imactivatefunc = function('NonExistingFunc')", 'E700:') | |
266 call assert_fails("let &imstatusfunc = function('NonExistingFunc')", 'E700:') | |
267 let g:IMactivatefunc_called = 0 | |
268 let g:IMstatusfunc_called = 0 | |
269 normal! i | |
270 call assert_equal(2, g:IMactivatefunc_called) | |
271 call assert_equal(2, g:IMstatusfunc_called) | |
272 | |
260 " cleanup | 273 " cleanup |
261 delfunc IMactivatefunc1 | 274 delfunc IMactivatefunc1 |
262 delfunc IMstatusfunc1 | 275 delfunc IMstatusfunc1 |
263 set iminsert=0 | 276 set iminsert=0 |
264 set imactivatefunc= | 277 set imactivatefunc= |