Mercurial > vim
comparison src/testdir/test_vim9_fails.vim @ 30443:54e36d01847b v9.0.0557
patch 9.0.0557: valgrind reports possibly leaked memory
Commit: https://github.com/vim/vim/commit/259a741044812df739457e25eb5195d9c5c0e6f8
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 23 16:11:37 2022 +0100
patch 9.0.0557: valgrind reports possibly leaked memory
Problem: Valgrind reports possibly leaked memory.
Solution: Move the problematic test function to the "fails" test file to
avoid obscuring real memory leaks.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 23 Sep 2022 17:15:05 +0200 |
parents | b94ef0b282f1 |
children |
comparison
equal
deleted
inserted
replaced
30442:a357f581ca7b | 30443:54e36d01847b |
---|---|
24 assert_equal('dict<any>', typename(job_info(jobs[0]))) | 24 assert_equal('dict<any>', typename(job_info(jobs[0]))) |
25 job_stop(job) | 25 job_stop(job) |
26 endif | 26 endif |
27 enddef | 27 enddef |
28 | 28 |
29 " Using "idx" from a legacy global function does not work. | |
30 " This caused a crash when called from legacy context. | |
31 " This creates a dict that contains a partial that refers to the dict, causing | |
32 " valgrind to report "possibly leaked memory". | |
33 func Test_partial_call_fails() | |
34 let lines =<< trim END | |
35 vim9script | |
36 | |
37 var l = ['a', 'b', 'c'] | |
38 def Iter(container: any): any | |
39 var idx = -1 | |
40 var obj = {state: container} | |
41 def g:NextItem__(self: dict<any>): any | |
42 ++idx | |
43 return self.state[idx] | |
44 enddef | |
45 obj.__next__ = function('g:NextItem__', [obj]) | |
46 return obj | |
47 enddef | |
48 | |
49 var it = Iter(l) | |
50 echo it.__next__() | |
51 END | |
52 call writefile(lines, 'XpartialCall', 'D') | |
53 let caught = 'no' | |
54 try | |
55 source XpartialCall | |
56 catch /E1248:/ | |
57 let caught = 'yes' | |
58 endtry | |
59 call assert_equal('yes', caught) | |
60 delfunc g:NextItem__ | |
61 endfunc | |
62 |