To: vim_dev@googlegroups.com Subject: Patch 9.0.1398 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1398 Problem: Profile test repeats the headers many times. Solution: Put the headers in script variables. Files: src/testdir/test_profile.vim *** ../vim-9.0.1397/src/testdir/test_profile.vim 2022-09-30 21:57:07.547153409 +0100 --- src/testdir/test_profile.vim 2023-03-10 18:26:36.224972853 +0000 *************** *** 6,11 **** --- 6,14 ---- source shared.vim source screendump.vim + let s:header = 'count total (s) self (s)' + let s:header_func = 'count total (s) self (s) function' + func Test_profile_func() call RunProfileFunc('func', 'let', 'let') call RunProfileFunc('def', 'var', '') *************** *** 71,84 **** call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[3]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[4]) call assert_equal('', lines[5]) ! call assert_equal('count total (s) self (s)', lines[6]) call assert_equal('', lines[7]) call assert_equal('FUNCTION Foo2()', lines[8]) call assert_equal('Called 1 time', lines[10]) call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[11]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[12]) call assert_equal('', lines[13]) ! call assert_equal('count total (s) self (s)', lines[14]) call assert_match('^\s*1\s\+.*\s\(let\|var\) counter = 100$', lines[15]) call assert_match('^\s*101\s\+.*\swhile counter > 0$', lines[16]) call assert_match('^\s*100\s\+.*\s \(let\)\= counter = counter - 1$', lines[17]) --- 74,87 ---- call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[3]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[4]) call assert_equal('', lines[5]) ! call assert_equal(s:header, lines[6]) call assert_equal('', lines[7]) call assert_equal('FUNCTION Foo2()', lines[8]) call assert_equal('Called 1 time', lines[10]) call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[11]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[12]) call assert_equal('', lines[13]) ! call assert_equal(s:header, lines[14]) call assert_match('^\s*1\s\+.*\s\(let\|var\) counter = 100$', lines[15]) call assert_match('^\s*101\s\+.*\swhile counter > 0$', lines[16]) call assert_match('^\s*100\s\+.*\s \(let\)\= counter = counter - 1$', lines[17]) *************** *** 86,97 **** call assert_match('^\s*1\s\+.\+sleep 1m$', lines[19]) call assert_equal('', lines[20]) call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[21]) ! call assert_equal('count total (s) self (s) function', lines[22]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$', lines[23]) call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$', lines[24]) call assert_equal('', lines[25]) call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[26]) ! call assert_equal('count total (s) self (s) function', lines[27]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$', lines[28]) call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$', lines[29]) call assert_equal('', lines[30]) --- 89,100 ---- call assert_match('^\s*1\s\+.\+sleep 1m$', lines[19]) call assert_equal('', lines[20]) call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[21]) ! call assert_equal(s:header_func, lines[22]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$', lines[23]) call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$', lines[24]) call assert_equal('', lines[25]) call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[26]) ! call assert_equal(s:header_func, lines[27]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$', lines[28]) call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$', lines[29]) call assert_equal('', lines[30]) *************** *** 163,169 **** call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[3]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[4]) call assert_equal('', lines[5]) ! call assert_equal('count total (s) self (s)', lines[6]) call assert_match('^\s*1\s\+.*\sif 1$', lines[7]) call assert_match('^\s*1\s\+.*\s \(let\|var\) x = 0$', lines[8]) call assert_match( '^\s\+elseif 1$', lines[9]) --- 166,172 ---- call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[3]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[4]) call assert_equal('', lines[5]) ! call assert_equal(s:header, lines[6]) call assert_match('^\s*1\s\+.*\sif 1$', lines[7]) call assert_match('^\s*1\s\+.*\s \(let\|var\) x = 0$', lines[8]) call assert_match( '^\s\+elseif 1$', lines[9]) *************** *** 177,183 **** call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[18]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[19]) call assert_equal('', lines[20]) ! call assert_equal('count total (s) self (s)', lines[21]) call assert_match('^\s*1\s\+.*\sif 0$', lines[22]) call assert_match( '^\s\+\(let\|var\) x = 0$', lines[23]) call assert_match('^\s*1\s\+.*\selseif 1$', lines[24]) --- 180,186 ---- call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[18]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[19]) call assert_equal('', lines[20]) ! call assert_equal(s:header, lines[21]) call assert_match('^\s*1\s\+.*\sif 0$', lines[22]) call assert_match( '^\s\+\(let\|var\) x = 0$', lines[23]) call assert_match('^\s*1\s\+.*\selseif 1$', lines[24]) *************** *** 191,197 **** call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[33]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[34]) call assert_equal('', lines[35]) ! call assert_equal('count total (s) self (s)', lines[36]) call assert_match('^\s*1\s\+.*\sif 0$', lines[37]) call assert_match( '^\s\+\(let\|var\) x = 0$', lines[38]) call assert_match('^\s*1\s\+.*\selseif 0$', lines[39]) --- 194,200 ---- call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[33]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[34]) call assert_equal('', lines[35]) ! call assert_equal(s:header, lines[36]) call assert_match('^\s*1\s\+.*\sif 0$', lines[37]) call assert_match( '^\s\+\(let\|var\) x = 0$', lines[38]) call assert_match('^\s*1\s\+.*\selseif 0$', lines[39]) *************** *** 201,213 **** call assert_match('^\s*1\s\+.*\sendif$', lines[43]) call assert_equal('', lines[44]) call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[45]) ! call assert_equal('count total (s) self (s) function', lines[46]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[47]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[48]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[49]) call assert_equal('', lines[50]) call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[51]) ! call assert_equal('count total (s) self (s) function', lines[52]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[53]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[54]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[55]) --- 204,216 ---- call assert_match('^\s*1\s\+.*\sendif$', lines[43]) call assert_equal('', lines[44]) call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[45]) ! call assert_equal(s:header_func, lines[46]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[47]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[48]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[49]) call assert_equal('', lines[50]) call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[51]) ! call assert_equal(s:header_func, lines[52]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[53]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[54]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[55]) *************** *** 289,295 **** call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[3]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[4]) call assert_equal('', lines[5]) ! call assert_equal('count total (s) self (s)', lines[6]) call assert_match('^\s*1\s\+.*\stry$', lines[7]) call assert_match('^\s*1\s\+.*\s \(let\|var\) x = 0$', lines[8]) call assert_match( '^\s\+catch$', lines[9]) --- 292,298 ---- call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[3]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[4]) call assert_equal('', lines[5]) ! call assert_equal(s:header, lines[6]) call assert_match('^\s*1\s\+.*\stry$', lines[7]) call assert_match('^\s*1\s\+.*\s \(let\|var\) x = 0$', lines[8]) call assert_match( '^\s\+catch$', lines[9]) *************** *** 303,309 **** call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[18]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[19]) call assert_equal('', lines[20]) ! call assert_equal('count total (s) self (s)', lines[21]) call assert_match('^\s*1\s\+.*\stry$', lines[22]) call assert_match('^\s*1\s\+.*\s throw 0$', lines[23]) call assert_match('^\s*1\s\+.*\scatch$', lines[24]) --- 306,312 ---- call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[18]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[19]) call assert_equal('', lines[20]) ! call assert_equal(s:header, lines[21]) call assert_match('^\s*1\s\+.*\stry$', lines[22]) call assert_match('^\s*1\s\+.*\s throw 0$', lines[23]) call assert_match('^\s*1\s\+.*\scatch$', lines[24]) *************** *** 317,323 **** call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[33]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[34]) call assert_equal('', lines[35]) ! call assert_equal('count total (s) self (s)', lines[36]) call assert_match('^\s*1\s\+.*\stry$', lines[37]) call assert_match('^\s*1\s\+.*\s throw 0$', lines[38]) call assert_match('^\s*1\s\+.*\scatch$', lines[39]) --- 320,326 ---- call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[33]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[34]) call assert_equal('', lines[35]) ! call assert_equal(s:header, lines[36]) call assert_match('^\s*1\s\+.*\stry$', lines[37]) call assert_match('^\s*1\s\+.*\s throw 0$', lines[38]) call assert_match('^\s*1\s\+.*\scatch$', lines[39]) *************** *** 327,339 **** call assert_match( '^\s\+endtry$', lines[43]) call assert_equal('', lines[44]) call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[45]) ! call assert_equal('count total (s) self (s) function', lines[46]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[47]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[48]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[49]) call assert_equal('', lines[50]) call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[51]) ! call assert_equal('count total (s) self (s) function', lines[52]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[53]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[54]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[55]) --- 330,342 ---- call assert_match( '^\s\+endtry$', lines[43]) call assert_equal('', lines[44]) call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[45]) ! call assert_equal(s:header_func, lines[46]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[47]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[48]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[49]) call assert_equal('', lines[50]) call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[51]) ! call assert_equal(s:header_func, lines[52]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[53]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[54]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[55]) *************** *** 372,378 **** call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[2]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[3]) call assert_equal('', lines[4]) ! call assert_equal('count total (s) self (s)', lines[5]) call assert_match(' 2 0.\d\+ func! Foo()', lines[6]) call assert_equal(' endfunc', lines[7]) " Loop iterates 10 times. Since script runs twice, body executes 20 times. --- 375,381 ---- call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[2]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[3]) call assert_equal('', lines[4]) ! call assert_equal(s:header, lines[5]) call assert_match(' 2 0.\d\+ func! Foo()', lines[6]) call assert_equal(' endfunc', lines[7]) " Loop iterates 10 times. Since script runs twice, body executes 20 times. *************** *** 414,420 **** call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[2]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[3]) call assert_equal('', lines[4]) ! call assert_equal('count total (s) self (s)', lines[5]) call assert_match(' 1 0.\d\+ echo "hello', lines[6]) call assert_equal(' \ world"', lines[7]) call assert_match(' 1 0.\d\+ echo "foo ', lines[8]) --- 417,423 ---- call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[2]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[3]) call assert_equal('', lines[4]) ! call assert_equal(s:header, lines[5]) call assert_match(' 1 0.\d\+ echo "hello', lines[6]) call assert_equal(' \ world"', lines[7]) call assert_match(' 1 0.\d\+ echo "foo ', lines[8]) *************** *** 450,464 **** call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[3]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[4]) call assert_equal('', lines[5]) ! call assert_equal('count total (s) self (s)', lines[6]) call assert_match('^\s*1\s\+.*\sreturn "Hello"$', lines[7]) call assert_equal('', lines[8]) call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[9]) ! call assert_equal('count total (s) self (s) function', lines[10]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Xprof_test1()$', lines[11]) call assert_equal('', lines[12]) call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[13]) ! call assert_equal('count total (s) self (s) function', lines[14]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Xprof_test1()$', lines[15]) call assert_equal('', lines[16]) --- 453,467 ---- call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[3]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[4]) call assert_equal('', lines[5]) ! call assert_equal(s:header, lines[6]) call assert_match('^\s*1\s\+.*\sreturn "Hello"$', lines[7]) call assert_equal('', lines[8]) call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[9]) ! call assert_equal(s:header_func, lines[10]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Xprof_test1()$', lines[11]) call assert_equal('', lines[12]) call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[13]) ! call assert_equal(s:header_func, lines[14]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Xprof_test1()$', lines[15]) call assert_equal('', lines[16]) *************** *** 475,489 **** call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[3]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[4]) call assert_equal('', lines[5]) ! call assert_equal('count total (s) self (s)', lines[6]) call assert_match('^\s*1\s\+.*\sreturn "World"$', lines[7]) call assert_equal('', lines[8]) call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[9]) ! call assert_equal('count total (s) self (s) function', lines[10]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Xprof_test2()$', lines[11]) call assert_equal('', lines[12]) call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[13]) ! call assert_equal('count total (s) self (s) function', lines[14]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Xprof_test2()$', lines[15]) call assert_equal('', lines[16]) --- 478,492 ---- call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[3]) call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[4]) call assert_equal('', lines[5]) ! call assert_equal(s:header, lines[6]) call assert_match('^\s*1\s\+.*\sreturn "World"$', lines[7]) call assert_equal('', lines[8]) call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[9]) ! call assert_equal(s:header_func, lines[10]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Xprof_test2()$', lines[11]) call assert_equal('', lines[12]) call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[13]) ! call assert_equal(s:header_func, lines[14]) call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Xprof_test2()$', lines[15]) call assert_equal('', lines[16]) *** ../vim-9.0.1397/src/version.c 2023-03-10 16:34:27.572958668 +0000 --- src/version.c 2023-03-10 18:27:38.901028608 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1398, /**/ -- hundred-and-one symptoms of being an internet addict: 255. You work for a newspaper and your editor asks you to write an article about Internet addiction...in the "first person." /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///