diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-08-30 18:37:26 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-08-30 18:37:26 +0200 |
commit | 163588005da3a240e49416093d0d0251951d60a1 (patch) | |
tree | aecfcef01a89c3dc66b9327d6af27404b32fa9cd /src/testdir/test_profile.vim | |
parent | 9e67b6a6a126f401417590dedf1bd38f71bfbae4 (diff) | |
download | vim-git-163588005da3a240e49416093d0d0251951d60a1.tar.gz |
patch 8.1.1946: memory error when profiling a function without a script IDv8.1.1946
Problem: Memory error when profiling a function without a script ID.
Solution: Check for missing script ID. (closes #4877)
Diffstat (limited to 'src/testdir/test_profile.vim')
-rw-r--r-- | src/testdir/test_profile.vim | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/testdir/test_profile.vim b/src/testdir/test_profile.vim index c7f515a89..d0546df86 100644 --- a/src/testdir/test_profile.vim +++ b/src/testdir/test_profile.vim @@ -4,6 +4,7 @@ source check.vim CheckFeature profile source shared.vim +source screendump.vim func Test_profile_func() let lines =<< trim [CODE] @@ -522,3 +523,29 @@ func Test_profdel_star() call delete('Xprofile_file.vim') call delete('Xprofile_file.log') endfunc + +" When typing the function it won't have a script ID, test that this works. +func Test_profile_typed_func() + CheckScreendump + + let lines =<< trim END + profile start XprofileTypedFunc + END + call writefile(lines, 'XtestProfile') + let buf = RunVimInTerminal('-S XtestProfile', #{}) + + call term_sendkeys(buf, ":func DoSomething()\<CR>" + \ .. "echo 'hello'\<CR>" + \ .. "endfunc\<CR>") + call term_sendkeys(buf, ":profile func DoSomething\<CR>") + call term_sendkeys(buf, ":call DoSomething()\<CR>") + call term_wait(buf, 200) + call StopVimInTerminal(buf) + let lines = readfile('XprofileTypedFunc') + call assert_equal("FUNCTION DoSomething()", lines[0]) + call assert_equal("Called 1 time", lines[1]) + + " clean up + call delete('XprofileTypedFunc') + call delete('XtestProfile') +endfunc |