Mercurial > vim
diff src/testdir/test_channel.vim @ 8881:ed0b39dd7fd6 v7.4.1727
commit https://github.com/vim/vim/commit/ebf7dfa6f121c82f97d2adca3d45fbaba9ad8f7e
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Apr 14 12:46:51 2016 +0200
patch 7.4.1727
Problem: Cannot detect a crash in tests when caused by garbagecollect().
Solution: Add garbagecollect_for_testing(). Do not free a job if is still
useful.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 14 Apr 2016 13:00:06 +0200 |
parents | 03250bc0c63a |
children | 072556995a8e |
line wrap: on
line diff
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -183,7 +183,7 @@ func s:communicate(port) call assert_equal('got it', s:responseMsg) " Collect garbage, tests that our handle isn't collected. - call garbagecollect() + call garbagecollect_for_testing() " check setting options (without testing the effect) call ch_setoptions(handle, {'callback': 's:NotUsed'}) @@ -1231,7 +1231,7 @@ func Test_job_start_invalid() call assert_fails('call job_start("")', 'E474:') endfunc -" This leaking memory. +" This was leaking memory. func Test_partial_in_channel_cycle() let d = {} let d.a = function('string', [d]) @@ -1243,5 +1243,13 @@ func Test_partial_in_channel_cycle() unlet d endfunc +func Test_using_freed_memory() + let g:a = job_start(['ls']) + sleep 10m + call garbagecollect_for_testing() +endfunc + + + " Uncomment this to see what happens, output is in src/testdir/channellog. " call ch_logfile('channellog', 'w')