Mercurial > vim
comparison src/testdir/test_profile.vim @ 17899:48fd0712dad8 v8.1.1946
patch 8.1.1946: memory error when profiling a function without a script ID
Commit: https://github.com/vim/vim/commit/163588005da3a240e49416093d0d0251951d60a1
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 30 18:37:26 2019 +0200
patch 8.1.1946: memory error when profiling a function without a script ID
Problem: Memory error when profiling a function without a script ID.
Solution: Check for missing script ID. (closes https://github.com/vim/vim/issues/4877)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 30 Aug 2019 18:45:03 +0200 |
parents | 131f1d8c5860 |
children | ed222e264905 |
comparison
equal
deleted
inserted
replaced
17898:a7551a81103d | 17899:48fd0712dad8 |
---|---|
2 | 2 |
3 source check.vim | 3 source check.vim |
4 CheckFeature profile | 4 CheckFeature profile |
5 | 5 |
6 source shared.vim | 6 source shared.vim |
7 source screendump.vim | |
7 | 8 |
8 func Test_profile_func() | 9 func Test_profile_func() |
9 let lines =<< trim [CODE] | 10 let lines =<< trim [CODE] |
10 profile start Xprofile_func.log | 11 profile start Xprofile_func.log |
11 profile func Foo* | 12 profile func Foo* |
520 call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[12]) | 521 call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[12]) |
521 | 522 |
522 call delete('Xprofile_file.vim') | 523 call delete('Xprofile_file.vim') |
523 call delete('Xprofile_file.log') | 524 call delete('Xprofile_file.log') |
524 endfunc | 525 endfunc |
526 | |
527 " When typing the function it won't have a script ID, test that this works. | |
528 func Test_profile_typed_func() | |
529 CheckScreendump | |
530 | |
531 let lines =<< trim END | |
532 profile start XprofileTypedFunc | |
533 END | |
534 call writefile(lines, 'XtestProfile') | |
535 let buf = RunVimInTerminal('-S XtestProfile', #{}) | |
536 | |
537 call term_sendkeys(buf, ":func DoSomething()\<CR>" | |
538 \ .. "echo 'hello'\<CR>" | |
539 \ .. "endfunc\<CR>") | |
540 call term_sendkeys(buf, ":profile func DoSomething\<CR>") | |
541 call term_sendkeys(buf, ":call DoSomething()\<CR>") | |
542 call term_wait(buf, 200) | |
543 call StopVimInTerminal(buf) | |
544 let lines = readfile('XprofileTypedFunc') | |
545 call assert_equal("FUNCTION DoSomething()", lines[0]) | |
546 call assert_equal("Called 1 time", lines[1]) | |
547 | |
548 " clean up | |
549 call delete('XprofileTypedFunc') | |
550 call delete('XtestProfile') | |
551 endfunc |