Mercurial > vim
comparison src/testdir/test_vim9_script.vim @ 19726:ad37a198a708 v8.2.0419
patch 8.2.0419: various memory leaks in Vim9 script code
Commit: https://github.com/vim/vim/commit/20431c9dbb592ebe0666bf042af7d2b373107372
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Mar 20 18:39:46 2020 +0100
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 https://github.com/vim/vim/issues/5814)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 20 Mar 2020 18:45:04 +0100 |
parents | 2fee087c94cb |
children | 41a1ea967a97 |
comparison
equal
deleted
inserted
replaced
19725:700b7d225e02 | 19726:ad37a198a708 |
---|---|
940 result ..= cnt .. '_' | 940 result ..= cnt .. '_' |
941 endwhile | 941 endwhile |
942 assert_equal('1_3_', result) | 942 assert_equal('1_3_', result) |
943 enddef | 943 enddef |
944 | 944 |
945 def Test_interrupt_loop() | |
946 let x = 0 | |
947 while 1 | |
948 x += 1 | |
949 if x == 100 | |
950 feedkeys("\<C-C>", 'L') | |
951 endif | |
952 endwhile | |
953 enddef | |
954 | |
945 def Test_substitute_cmd() | 955 def Test_substitute_cmd() |
946 new | 956 new |
947 setline(1, 'something') | 957 setline(1, 'something') |
948 :substitute(some(other( | 958 :substitute(some(other( |
949 assert_equal('otherthing', getline(1)) | 959 assert_equal('otherthing', getline(1)) |
962 source Xvim9lines | 972 source Xvim9lines |
963 | 973 |
964 delete('Xvim9lines') | 974 delete('Xvim9lines') |
965 enddef | 975 enddef |
966 | 976 |
977 def Test_redef_failure() | |
978 call writefile(['def Func0(): string', 'return "Func0"', 'enddef'], 'Xdef') | |
979 so Xdef | |
980 call writefile(['def Func1(): string', 'return "Func1"', 'enddef'], 'Xdef') | |
981 so Xdef | |
982 call writefile(['def! Func0(): string', 'enddef'], 'Xdef') | |
983 call assert_fails('so Xdef', 'E1027:') | |
984 call writefile(['def Func2(): string', 'return "Func2"', 'enddef'], 'Xdef') | |
985 so Xdef | |
986 call delete('Xdef') | |
987 | |
988 call assert_equal(0, Func0()) | |
989 call assert_equal('Func1', Func1()) | |
990 call assert_equal('Func2', Func2()) | |
991 | |
992 delfunc! Func0 | |
993 delfunc! Func1 | |
994 delfunc! Func2 | |
995 enddef | |
996 | |
967 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker | 997 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |