@@ -7,22 +7,27 @@ source shared.vim
77source screendump.vim
88
99func Test_profile_func ()
10+ call RunProfileFunc (' func' , ' let' , ' let' )
11+ call RunProfileFunc (' def' , ' var' , ' ' )
12+ endfunc
13+
14+ func RunProfileFunc (command , declare, assign)
1015 let lines = << trim [CODE]
1116 profile start Xprofile_func.log
1217 profile func Foo*
13- func ! Foo1 ()
14- endfunc
15- func ! Foo2 ()
16- let l: count = 100
17- while l: count > 0
18- let l: count = l: count - 1
18+ XXX Foo1 ()
19+ endXXX
20+ XXX Foo2 ()
21+ DDD counter = 100
22+ while counter > 0
23+ AAA counter = counter - 1
1924 endwhile
2025 sleep 1 m
21- endfunc
22- func ! Foo3 ()
23- endfunc
24- func ! Bar ()
25- endfunc
26+ endXXX
27+ XXX Foo3 ()
28+ endXXX
29+ XXX Bar ()
30+ endXXX
2631 call Foo1 ()
2732 call Foo1 ()
2833 profile pause
@@ -37,6 +42,10 @@ func Test_profile_func()
3742 delfunc Foo3
3843 [CODE]
3944
45+ call map (lines , {k , v - > substitute (v , ' XXX' , a: command , ' ' ) })
46+ call map (lines , {k , v - > substitute (v , ' DDD' , a: declare , ' ' ) })
47+ call map (lines , {k , v - > substitute (v , ' AAA' , a: assign , ' ' ) })
48+
4049 call writefile (lines , ' Xprofile_func.vim' )
4150 call system (GetVimCommand ()
4251 \ . ' -es --clean'
@@ -69,10 +78,10 @@ func Test_profile_func()
6978 call assert_match (' ^ Self time:\s\+\d\+\.\d\+$' , lines [12 ])
7079 call assert_equal (' ' , lines [13 ])
7180 call assert_equal (' count total (s) self (s)' , lines [14 ])
72- call assert_match (' ^\s*1\s\+.*\slet l:count = 100$' , lines [15 ])
73- call assert_match (' ^\s*101\s\+.*\swhile l:count > 0$' , lines [16 ])
74- call assert_match (' ^\s*100\s\+.*\s let l:count = l:count - 1$' , lines [17 ])
75- call assert_match (' ^\s*101 \s\+.*\sendwhile$' , lines [18 ])
81+ call assert_match (' ^\s*1\s\+.*\s\(let\|var\) counter = 100$' , lines [15 ])
82+ call assert_match (' ^\s*101\s\+.*\swhile counter > 0$' , lines [16 ])
83+ call assert_match (' ^\s*100\s\+.*\s \( let\)\= counter = counter - 1$' , lines [17 ])
84+ call assert_match (' ^\s*10[01] \s\+.*\sendwhile$' , lines [18 ])
7685 call assert_match (' ^\s*1\s\+.\+sleep 1m$' , lines [19 ])
7786 call assert_equal (' ' , lines [20 ])
7887 call assert_equal (' FUNCTIONS SORTED ON TOTAL TIME' , lines [21 ])
0 commit comments