annotate src/testdir/test_profile.vim @ 14591:96878f6f5d4c v8.1.0309

patch 8.1.0309: profiling does not show a count for condition lines commit https://github.com/vim/vim/commit/7feb35e7782907b44659a2748ff5d7489deeed74 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 21 17:49:54 2018 +0200 patch 8.1.0309: profiling does not show a count for condition lines Problem: Profiling does not show a count for condition lines. (Daniel Hahler) Solution: Count lines when not skipping. (Ozaki Kiichi, closes #2499)
author Christian Brabandt <cb@256bit.org>
date Tue, 21 Aug 2018 18:00:08 +0200
parents 24109c2e0b0b
children 2c0f454fcdc9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10599
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test Vim profiler
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 if !has('profile')
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 finish
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 endif
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 func Test_profile_func()
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 let lines = [
14228
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
8 \ 'profile start Xprofile_func.log',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
9 \ 'profile func Foo*"',
10599
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 \ "func! Foo1()",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 \ "endfunc",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 \ "func! Foo2()",
10613
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
13 \ " let l:count = 100",
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
14 \ " while l:count > 0",
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
15 \ " let l:count = l:count - 1",
10599
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 \ " endwhile",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 \ "endfunc",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 \ "func! Foo3()",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 \ "endfunc",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 \ "func! Bar()",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 \ "endfunc",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 \ "call Foo1()",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 \ "call Foo1()",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 \ "profile pause",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 \ "call Foo1()",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 \ "profile continue",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 \ "call Foo2()",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 \ "call Foo3()",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 \ "call Bar()",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 \ "if !v:profiling",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 \ " delfunc Foo2",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 \ "endif",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 \ "delfunc Foo3",
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 \ ]
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call writefile(lines, 'Xprofile_func.vim')
10613
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
37 call system(v:progpath
14228
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
38 \ . ' -es --clean'
10613
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
39 \ . ' -c "so Xprofile_func.vim"'
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
40 \ . ' -c "qall!"')
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
41 call assert_equal(0, v:shell_error)
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
42
10599
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 let lines = readfile('Xprofile_func.log')
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 " - Foo1() is called 3 times but should be reported as called twice
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 " since one call is in between "profile pause" .. "profile continue".
10613
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
47 " - Foo2() should come before Foo1() since Foo1() does much more work.
10599
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 " - Foo3() is not reported because function is deleted.
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 " - Unlike Foo3(), Foo2() should not be deleted since there is a check
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 " for v:profiling.
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 " - Bar() is not reported since it does not match "profile func Foo*".
10613
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
52 call assert_equal(28, len(lines))
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
53
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
54 call assert_equal('FUNCTION Foo1()', lines[0])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
55 call assert_equal('Called 2 times', lines[1])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
56 call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[2])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
57 call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[3])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
58 call assert_equal('', lines[4])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
59 call assert_equal('count total (s) self (s)', lines[5])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
60 call assert_equal('', lines[6])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
61 call assert_equal('FUNCTION Foo2()', lines[7])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
62 call assert_equal('Called 1 time', lines[8])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
63 call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[9])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
64 call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[10])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
65 call assert_equal('', lines[11])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
66 call assert_equal('count total (s) self (s)', lines[12])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
67 call assert_match('^\s*1\s\+.*\slet l:count = 100$', lines[13])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
68 call assert_match('^\s*101\s\+.*\swhile l:count > 0$', lines[14])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
69 call assert_match('^\s*100\s\+.*\s let l:count = l:count - 1$', lines[15])
14591
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
70 call assert_match('^\s*101\s\+.*\sendwhile$', lines[16])
10613
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
71 call assert_equal('', lines[17])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
72 call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[18])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
73 call assert_equal('count total (s) self (s) function', lines[19])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
74 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$', lines[20])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
75 call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$', lines[21])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
76 call assert_equal('', lines[22])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
77 call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[23])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
78 call assert_equal('count total (s) self (s) function', lines[24])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
79 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo2()$', lines[25])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
80 call assert_match('^\s*2\s\+\d\+\.\d\+\s\+Foo1()$', lines[26])
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
81 call assert_equal('', lines[27])
10599
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call delete('Xprofile_func.vim')
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 call delete('Xprofile_func.log')
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 endfunc
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86
14591
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
87 func Test_profile_func_with_ifelse()
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
88 let lines = [
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
89 \ "func! Foo1()",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
90 \ " if 1",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
91 \ " let x = 0",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
92 \ " elseif 1",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
93 \ " let x = 1",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
94 \ " else",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
95 \ " let x = 2",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
96 \ " endif",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
97 \ "endfunc",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
98 \ "func! Foo2()",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
99 \ " if 0",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
100 \ " let x = 0",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
101 \ " elseif 1",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
102 \ " let x = 1",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
103 \ " else",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
104 \ " let x = 2",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
105 \ " endif",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
106 \ "endfunc",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
107 \ "func! Foo3()",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
108 \ " if 0",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
109 \ " let x = 0",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
110 \ " elseif 0",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
111 \ " let x = 1",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
112 \ " else",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
113 \ " let x = 2",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
114 \ " endif",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
115 \ "endfunc",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
116 \ "call Foo1()",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
117 \ "call Foo2()",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
118 \ "call Foo3()",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
119 \ ]
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
120
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
121 call writefile(lines, 'Xprofile_func.vim')
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
122 call system(v:progpath
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
123 \ . ' -es -u NONE -U NONE -i NONE --noplugin'
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
124 \ . ' -c "profile start Xprofile_func.log"'
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
125 \ . ' -c "profile func Foo*"'
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
126 \ . ' -c "so Xprofile_func.vim"'
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
127 \ . ' -c "qall!"')
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
128 call assert_equal(0, v:shell_error)
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
129
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
130 let lines = readfile('Xprofile_func.log')
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
131
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
132 " - Foo1() should pass 'if' block.
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
133 " - Foo2() should pass 'elseif' block.
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
134 " - Foo3() should pass 'else' block.
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
135 call assert_equal(54, len(lines))
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
136
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
137 call assert_equal('FUNCTION Foo1()', lines[0])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
138 call assert_equal('Called 1 time', lines[1])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
139 call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[2])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
140 call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[3])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
141 call assert_equal('', lines[4])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
142 call assert_equal('count total (s) self (s)', lines[5])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
143 call assert_match('^\s*1\s\+.*\sif 1$', lines[6])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
144 call assert_match('^\s*1\s\+.*\s let x = 0$', lines[7])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
145 call assert_match( '^\s\+elseif 1$', lines[8])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
146 call assert_match( '^\s\+let x = 1$', lines[9])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
147 call assert_match( '^\s\+else$', lines[10])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
148 call assert_match( '^\s\+let x = 2$', lines[11])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
149 call assert_match('^\s*1\s\+.*\sendif$', lines[12])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
150 call assert_equal('', lines[13])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
151 call assert_equal('FUNCTION Foo2()', lines[14])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
152 call assert_equal('Called 1 time', lines[15])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
153 call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[16])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
154 call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[17])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
155 call assert_equal('', lines[18])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
156 call assert_equal('count total (s) self (s)', lines[19])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
157 call assert_match('^\s*1\s\+.*\sif 0$', lines[20])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
158 call assert_match( '^\s\+let x = 0$', lines[21])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
159 call assert_match('^\s*1\s\+.*\selseif 1$', lines[22])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
160 call assert_match('^\s*1\s\+.*\s let x = 1$', lines[23])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
161 call assert_match( '^\s\+else$', lines[24])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
162 call assert_match( '^\s\+let x = 2$', lines[25])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
163 call assert_match('^\s*1\s\+.*\sendif$', lines[26])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
164 call assert_equal('', lines[27])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
165 call assert_equal('FUNCTION Foo3()', lines[28])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
166 call assert_equal('Called 1 time', lines[29])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
167 call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[30])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
168 call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[31])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
169 call assert_equal('', lines[32])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
170 call assert_equal('count total (s) self (s)', lines[33])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
171 call assert_match('^\s*1\s\+.*\sif 0$', lines[34])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
172 call assert_match( '^\s\+let x = 0$', lines[35])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
173 call assert_match('^\s*1\s\+.*\selseif 0$', lines[36])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
174 call assert_match( '^\s\+let x = 1$', lines[37])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
175 call assert_match('^\s*1\s\+.*\selse$', lines[38])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
176 call assert_match('^\s*1\s\+.*\s let x = 2$', lines[39])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
177 call assert_match('^\s*1\s\+.*\sendif$', lines[40])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
178 call assert_equal('', lines[41])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
179 call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[42])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
180 call assert_equal('count total (s) self (s) function', lines[43])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
181 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[44])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
182 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[45])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
183 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[46])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
184 call assert_equal('', lines[47])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
185 call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[48])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
186 call assert_equal('count total (s) self (s) function', lines[49])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
187 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[50])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
188 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[51])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
189 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[52])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
190 call assert_equal('', lines[53])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
191
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
192 call delete('Xprofile_func.vim')
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
193 call delete('Xprofile_func.log')
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
194 endfunc
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
195
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
196 func Test_profile_func_with_trycatch()
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
197 let lines = [
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
198 \ "func! Foo1()",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
199 \ " try",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
200 \ " let x = 0",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
201 \ " catch",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
202 \ " let x = 1",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
203 \ " finally",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
204 \ " let x = 2",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
205 \ " endtry",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
206 \ "endfunc",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
207 \ "func! Foo2()",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
208 \ " try",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
209 \ " throw 0",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
210 \ " catch",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
211 \ " let x = 1",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
212 \ " finally",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
213 \ " let x = 2",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
214 \ " endtry",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
215 \ "endfunc",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
216 \ "func! Foo3()",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
217 \ " try",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
218 \ " throw 0",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
219 \ " catch",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
220 \ " throw 1",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
221 \ " finally",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
222 \ " let x = 2",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
223 \ " endtry",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
224 \ "endfunc",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
225 \ "call Foo1()",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
226 \ "call Foo2()",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
227 \ "try",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
228 \ " call Foo3()",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
229 \ "catch",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
230 \ "endtry",
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
231 \ ]
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
232
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
233 call writefile(lines, 'Xprofile_func.vim')
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
234 call system(v:progpath
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
235 \ . ' -es -u NONE -U NONE -i NONE --noplugin'
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
236 \ . ' -c "profile start Xprofile_func.log"'
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
237 \ . ' -c "profile func Foo*"'
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
238 \ . ' -c "so Xprofile_func.vim"'
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
239 \ . ' -c "qall!"')
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
240 call assert_equal(0, v:shell_error)
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
241
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
242 let lines = readfile('Xprofile_func.log')
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
243
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
244 " - Foo1() should pass 'try' 'finally' blocks.
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
245 " - Foo2() should pass 'catch' 'finally' blocks.
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
246 " - Foo3() should not pass 'endtry'.
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
247 call assert_equal(54, len(lines))
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
248
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
249 call assert_equal('FUNCTION Foo1()', lines[0])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
250 call assert_equal('Called 1 time', lines[1])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
251 call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[2])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
252 call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[3])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
253 call assert_equal('', lines[4])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
254 call assert_equal('count total (s) self (s)', lines[5])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
255 call assert_match('^\s*1\s\+.*\stry$', lines[6])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
256 call assert_match('^\s*1\s\+.*\s let x = 0$', lines[7])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
257 call assert_match( '^\s\+catch$', lines[8])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
258 call assert_match( '^\s\+let x = 1$', lines[9])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
259 call assert_match('^\s*1\s\+.*\sfinally$', lines[10])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
260 call assert_match('^\s*1\s\+.*\s let x = 2$', lines[11])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
261 call assert_match('^\s*1\s\+.*\sendtry$', lines[12])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
262 call assert_equal('', lines[13])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
263 call assert_equal('FUNCTION Foo2()', lines[14])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
264 call assert_equal('Called 1 time', lines[15])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
265 call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[16])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
266 call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[17])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
267 call assert_equal('', lines[18])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
268 call assert_equal('count total (s) self (s)', lines[19])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
269 call assert_match('^\s*1\s\+.*\stry$', lines[20])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
270 call assert_match('^\s*1\s\+.*\s throw 0$', lines[21])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
271 call assert_match('^\s*1\s\+.*\scatch$', lines[22])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
272 call assert_match('^\s*1\s\+.*\s let x = 1$', lines[23])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
273 call assert_match('^\s*1\s\+.*\sfinally$', lines[24])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
274 call assert_match('^\s*1\s\+.*\s let x = 2$', lines[25])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
275 call assert_match('^\s*1\s\+.*\sendtry$', lines[26])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
276 call assert_equal('', lines[27])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
277 call assert_equal('FUNCTION Foo3()', lines[28])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
278 call assert_equal('Called 1 time', lines[29])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
279 call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[30])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
280 call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[31])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
281 call assert_equal('', lines[32])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
282 call assert_equal('count total (s) self (s)', lines[33])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
283 call assert_match('^\s*1\s\+.*\stry$', lines[34])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
284 call assert_match('^\s*1\s\+.*\s throw 0$', lines[35])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
285 call assert_match('^\s*1\s\+.*\scatch$', lines[36])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
286 call assert_match('^\s*1\s\+.*\s throw 1$', lines[37])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
287 call assert_match('^\s*1\s\+.*\sfinally$', lines[38])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
288 call assert_match('^\s*1\s\+.*\s let x = 2$', lines[39])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
289 call assert_match( '^\s\+endtry$', lines[40])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
290 call assert_equal('', lines[41])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
291 call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[42])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
292 call assert_equal('count total (s) self (s) function', lines[43])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
293 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[44])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
294 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[45])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
295 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[46])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
296 call assert_equal('', lines[47])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
297 call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[48])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
298 call assert_equal('count total (s) self (s) function', lines[49])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
299 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[50])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
300 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[51])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
301 call assert_match('^\s*1\s\+\d\+\.\d\+\s\+Foo.()$', lines[52])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
302 call assert_equal('', lines[53])
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
303
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
304 call delete('Xprofile_func.vim')
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
305 call delete('Xprofile_func.log')
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
306 endfunc
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
307
10599
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
308 func Test_profile_file()
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
309 let lines = [
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
310 \ 'func! Foo()',
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
311 \ 'endfunc',
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
312 \ 'for i in range(10)',
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
313 \ ' " a comment',
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
314 \ ' call Foo()',
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
315 \ 'endfor',
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
316 \ 'call Foo()',
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
317 \ ]
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
318
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
319 call writefile(lines, 'Xprofile_file.vim')
10613
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
320 call system(v:progpath
14228
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
321 \ . ' -es --clean'
10613
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
322 \ . ' -c "profile start Xprofile_file.log"'
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
323 \ . ' -c "profile file Xprofile_file.vim"'
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
324 \ . ' -c "so Xprofile_file.vim"'
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
325 \ . ' -c "so Xprofile_file.vim"'
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
326 \ . ' -c "qall!"')
196757b230a2 patch 8.0.0196: profile test is slo and does not work on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10609
diff changeset
327 call assert_equal(0, v:shell_error)
10599
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
328
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
329 let lines = readfile('Xprofile_file.log')
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
330
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
331 call assert_equal(14, len(lines))
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
332
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
333 call assert_match('^SCRIPT .*Xprofile_file.vim$', lines[0])
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
334 call assert_equal('Sourced 2 times', lines[1])
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
335 call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[2])
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
336 call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[3])
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
337 call assert_equal('', lines[4])
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
338 call assert_equal('count total (s) self (s)', lines[5])
12658
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
339 call assert_match(' 2 0.\d\+ func! Foo()', lines[6])
10599
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
340 call assert_equal(' endfunc', lines[7])
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
341 " Loop iterates 10 times. Since script runs twice, body executes 20 times.
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
342 " First line of loop executes one more time than body to detect end of loop.
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
343 call assert_match('^\s*22\s\+\d\+\.\d\+\s\+for i in range(10)$', lines[8])
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
344 call assert_equal(' " a comment', lines[9])
12128
2f4eb2e10766 patch 8.0.0944: test_profile is a little bit flaky
Christian Brabandt <cb@256bit.org>
parents: 10613
diff changeset
345 " if self and total are equal we only get one number
2f4eb2e10766 patch 8.0.0944: test_profile is a little bit flaky
Christian Brabandt <cb@256bit.org>
parents: 10613
diff changeset
346 call assert_match('^\s*20\s\+\(\d\+\.\d\+\s\+\)\=\d\+\.\d\+\s\+call Foo()$', lines[10])
14591
96878f6f5d4c patch 8.1.0309: profiling does not show a count for condition lines
Christian Brabandt <cb@256bit.org>
parents: 14228
diff changeset
347 call assert_match('^\s*22\s\+\d\+\.\d\+\s\+endfor$', lines[11])
10609
302aedeed8c9 patch 8.0.0194: profile tests fails if total and self time are equal
Christian Brabandt <cb@256bit.org>
parents: 10599
diff changeset
348 " if self and total are equal we only get one number
302aedeed8c9 patch 8.0.0194: profile tests fails if total and self time are equal
Christian Brabandt <cb@256bit.org>
parents: 10599
diff changeset
349 call assert_match('^\s*2\s\+\(\d\+\.\d\+\s\+\)\=\d\+\.\d\+\s\+call Foo()$', lines[12])
10599
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
350 call assert_equal('', lines[13])
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
351
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
352 call delete('Xprofile_file.vim')
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
353 call delete('Xprofile_file.log')
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
354 endfunc
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
355
12658
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
356 func Test_profile_file_with_cont()
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
357 let lines = [
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
358 \ 'echo "hello',
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
359 \ ' \ world"',
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
360 \ 'echo "foo ',
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
361 \ ' \bar"',
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
362 \ ]
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
363
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
364 call writefile(lines, 'Xprofile_file.vim')
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
365 call system(v:progpath
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
366 \ . ' -es --clean'
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
367 \ . ' -c "profile start Xprofile_file.log"'
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
368 \ . ' -c "profile file Xprofile_file.vim"'
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
369 \ . ' -c "so Xprofile_file.vim"'
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
370 \ . ' -c "qall!"')
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
371 call assert_equal(0, v:shell_error)
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
372
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
373 let lines = readfile('Xprofile_file.log')
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
374 call assert_equal(11, len(lines))
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
375
14228
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
376 call assert_match('^SCRIPT .*Xprofile_file.vim$', lines[0])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
377 call assert_equal('Sourced 1 time', lines[1])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
378 call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[2])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
379 call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[3])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
380 call assert_equal('', lines[4])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
381 call assert_equal('count total (s) self (s)', lines[5])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
382 call assert_match(' 1 0.\d\+ echo "hello', lines[6])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
383 call assert_equal(' \ world"', lines[7])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
384 call assert_match(' 1 0.\d\+ echo "foo ', lines[8])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
385 call assert_equal(' \bar"', lines[9])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
386 call assert_equal('', lines[10])
12658
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
387
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
388 call delete('Xprofile_file.vim')
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
389 call delete('Xprofile_file.log')
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
390 endfunc
20aacdca367d patch 8.0.1207: profiling skips the first and last script line
Christian Brabandt <cb@256bit.org>
parents: 12128
diff changeset
391
10599
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
392 func Test_profile_completion()
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
393 call feedkeys(":profile \<C-A>\<C-B>\"\<CR>", 'tx')
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
394 call assert_equal('"profile continue file func pause start', @:)
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
395
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
396 call feedkeys(":profile start test_prof\<C-A>\<C-B>\"\<CR>", 'tx')
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
397 call assert_match('^"profile start.* test_profile\.vim', @:)
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
398 endfunc
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
399
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
400 func Test_profile_errors()
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
401 call assert_fails("profile func Foo", 'E750:')
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
402 call assert_fails("profile pause", 'E750:')
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
403 call assert_fails("profile continue", 'E750:')
2748b23db6bb patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
404 endfunc
12992
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
405
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
406 func Test_profile_truncate_mbyte()
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
407 if !has('multi_byte') || &enc !=# 'utf-8'
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
408 return
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
409 endif
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
410
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
411 let lines = [
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
412 \ 'scriptencoding utf-8',
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
413 \ 'func! Foo()',
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
414 \ ' return [',
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
415 \ ' \ "' . join(map(range(0x4E00, 0x4E00 + 340), 'nr2char(v:val)'), '') . '",',
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
416 \ ' \ "' . join(map(range(0x4F00, 0x4F00 + 340), 'nr2char(v:val)'), '') . '",',
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
417 \ ' \ ]',
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
418 \ 'endfunc',
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
419 \ 'call Foo()',
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
420 \ ]
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
421
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
422 call writefile(lines, 'Xprofile_file.vim')
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
423 call system(v:progpath
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
424 \ . ' -es --clean --cmd "set enc=utf-8"'
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
425 \ . ' -c "profile start Xprofile_file.log"'
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
426 \ . ' -c "profile file Xprofile_file.vim"'
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
427 \ . ' -c "so Xprofile_file.vim"'
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
428 \ . ' -c "qall!"')
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
429 call assert_equal(0, v:shell_error)
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
430
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
431 split Xprofile_file.log
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
432 if &fenc != ''
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
433 call assert_equal('utf-8', &fenc)
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
434 endif
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
435 /func! Foo()
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
436 let lnum = line('.')
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
437 call assert_match('^\s*return \[$', getline(lnum + 1))
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
438 call assert_match("\u4F52$", getline(lnum + 2))
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
439 call assert_match("\u5052$", getline(lnum + 3))
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
440 call assert_match('^\s*\\ \]$', getline(lnum + 4))
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
441 bwipe!
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
442
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
443 call delete('Xprofile_file.vim')
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
444 call delete('Xprofile_file.log')
5532b5176870 patch 8.0.1372: profile log may be truncated halfway a character
Christian Brabandt <cb@256bit.org>
parents: 12658
diff changeset
445 endfunc
14228
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
446
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
447 func Test_profdel_func()
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
448 let lines = [
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
449 \ 'profile start Xprofile_file.log',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
450 \ 'func! Foo1()',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
451 \ 'endfunc',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
452 \ 'func! Foo2()',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
453 \ 'endfunc',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
454 \ 'func! Foo3()',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
455 \ 'endfunc',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
456 \ '',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
457 \ 'profile func Foo1',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
458 \ 'profile func Foo2',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
459 \ 'call Foo1()',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
460 \ 'call Foo2()',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
461 \ '',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
462 \ 'profile func Foo3',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
463 \ 'profdel func Foo2',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
464 \ 'profdel func Foo3',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
465 \ 'call Foo1()',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
466 \ 'call Foo2()',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
467 \ 'call Foo3()' ]
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
468 call writefile(lines, 'Xprofile_file.vim')
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
469 call system(v:progpath . ' -es --clean -c "so Xprofile_file.vim" -c q')
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
470 call assert_equal(0, v:shell_error)
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
471
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
472 let lines = readfile('Xprofile_file.log')
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
473 call assert_equal(24, len(lines))
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
474
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
475 " Check that:
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
476 " - Foo1() is called twice (profdel not invoked)
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
477 " - Foo2() is called once (profdel invoked after it was called)
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
478 " - Foo3() is not called (profdel invoked before it was called)
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
479 call assert_equal('FUNCTION Foo1()', lines[0])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
480 call assert_equal('Called 2 times', lines[1])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
481 call assert_equal('FUNCTION Foo2()', lines[7])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
482 call assert_equal('Called 1 time', lines[8])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
483 call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[14])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
484 call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[19])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
485
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
486 call delete('Xprofile_file.vim')
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
487 call delete('Xprofile_file.log')
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
488 endfunc
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
489
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
490 func Test_profdel_star()
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
491 " Foo() is invoked once before and once after 'profdel *'.
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
492 " So profiling should report it only once.
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
493 let lines = [
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
494 \ 'profile start Xprofile_file.log',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
495 \ 'func! Foo()',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
496 \ 'endfunc',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
497 \ 'profile func Foo',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
498 \ 'call Foo()',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
499 \ 'profdel *',
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
500 \ 'call Foo()' ]
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
501 call writefile(lines, 'Xprofile_file.vim')
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
502 call system(v:progpath . ' -es --clean -c "so Xprofile_file.vim" -c q')
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
503 call assert_equal(0, v:shell_error)
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
504
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
505 let lines = readfile('Xprofile_file.log')
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
506 call assert_equal(15, len(lines))
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
507
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
508 call assert_equal('FUNCTION Foo()', lines[0])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
509 call assert_equal('Called 1 time', lines[1])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
510 call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[7])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
511 call assert_equal('FUNCTIONS SORTED ON SELF TIME', lines[11])
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
512
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
513 call delete('Xprofile_file.vim')
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
514 call delete('Xprofile_file.log')
24109c2e0b0b patch 8.1.0131: :profdel is not tested
Christian Brabandt <cb@256bit.org>
parents: 12992
diff changeset
515 endfunc