1
0
forked from aniani/vim

patch 8.2.0419: various memory leaks in Vim9 script code

Problem:    Various memory leaks in Vim9 script code.
Solution:   Fix the leaks. (Ozaki Kiichi, closes #5814)
This commit is contained in:
Bram Moolenaar
2020-03-20 18:39:46 +01:00
parent 8b63313510
commit 20431c9dbb
9 changed files with 177 additions and 35 deletions

View File

@@ -942,6 +942,16 @@ def Test_while_loop()
assert_equal('1_3_', result)
enddef
def Test_interrupt_loop()
let x = 0
while 1
x += 1
if x == 100
feedkeys("\<C-C>", 'L')
endif
endwhile
enddef
def Test_substitute_cmd()
new
setline(1, 'something')
@@ -964,4 +974,24 @@ def Test_substitute_cmd()
delete('Xvim9lines')
enddef
def Test_redef_failure()
call writefile(['def Func0(): string', 'return "Func0"', 'enddef'], 'Xdef')
so Xdef
call writefile(['def Func1(): string', 'return "Func1"', 'enddef'], 'Xdef')
so Xdef
call writefile(['def! Func0(): string', 'enddef'], 'Xdef')
call assert_fails('so Xdef', 'E1027:')
call writefile(['def Func2(): string', 'return "Func2"', 'enddef'], 'Xdef')
so Xdef
call delete('Xdef')
call assert_equal(0, Func0())
call assert_equal('Func1', Func1())
call assert_equal('Func2', Func2())
delfunc! Func0
delfunc! Func1
delfunc! Func2
enddef
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker