summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-03-10 18:28:12 +0000
committerBram Moolenaar <Bram@vim.org>2023-03-10 18:28:12 +0000
commitc0bdbfb2ee026e913e23a5d6bcaa97d44d9a6406 (patch)
tree283649c1b6edeb5046cde61934faf460d451fa12
parent6a7c7749204b256e779c245b1e999bf852ad7b64 (diff)
patch 9.0.1398: profile test repeats the headers many timesv9.0.1398
Problem: Profile test repeats the headers many times. Solution: Put the headers in script variables.
-rw-r--r--src/testdir/test_profile.vim47
-rw-r--r--src/version.c2
2 files changed, 27 insertions, 22 deletions
diff --git a/src/testdir/test_profile.vim b/src/testdir/test_profile.vim
index d24acd30d4..e427179eae 100644
--- a/src/testdir/test_profile.vim
+++ b/src/testdir/test_profile.vim
@@ -6,6 +6,9 @@ CheckFeature profile
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,14 +74,14 @@ func RunProfileFunc(command, declare, assign)
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(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('count total (s) self (s)', lines[14])
+ 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,12 +89,12 @@ func RunProfileFunc(command, declare, assign)
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_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('count total (s) self (s) function', lines[27])
+ 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,7 +166,7 @@ func Run_profile_func_with_ifelse(command, declare)
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(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,7 +180,7 @@ func Run_profile_func_with_ifelse(command, declare)
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_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,7 +194,7 @@ func Run_profile_func_with_ifelse(command, declare)
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_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,13 +204,13 @@ func Run_profile_func_with_ifelse(command, declare)
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_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('count total (s) self (s) function', lines[52])
+ 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,7 +292,7 @@ func Run_profile_func_with_trycatch(command, declare)
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(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,7 +306,7 @@ func Run_profile_func_with_trycatch(command, declare)
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_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,7 +320,7 @@ func Run_profile_func_with_trycatch(command, declare)
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_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,13 +330,13 @@ func Run_profile_func_with_trycatch(command, declare)
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_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('count total (s) self (s) function', lines[52])
+ 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,7 +375,7 @@ func Test_profile_file()
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_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,7 +417,7 @@ func Test_profile_file_with_cont()
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_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,15 +453,15 @@ func Test_profile_stop_dump()
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(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('count total (s) self (s) function', lines[10])
+ 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('count total (s) self (s) function', lines[14])
+ 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,15 +478,15 @@ func Test_profile_stop_dump()
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(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('count total (s) self (s) function', lines[10])
+ 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('count total (s) self (s) function', lines[14])
+ 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])
diff --git a/src/version.c b/src/version.c
index b81b38d955..eb3fc5dc48 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1398,
+/**/
1397,
/**/
1396,