Mercurial > vim
annotate src/testdir/test_profile.vim @ 11545:1780e6fecb30 v8.0.0655
patch 8.0.0655: not easy to make sure a function does not exist
commit https://github.com/vim/vim/commit/d6abcd154cdc6a8dd4b7c6ccad37617ea8a1b4aa
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 22 19:15:24 2017 +0200
patch 8.0.0655: not easy to make sure a function does not exist
Problem: Not easy to make sure a function does not exist.
Solution: Add ! as an optional argument to :delfunc.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 22 Jun 2017 19:30:04 +0200 |
parents | 196757b230a2 |
children | 2f4eb2e10766 |
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 = [ |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 \ "func! Foo1()", |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 \ "endfunc", |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 \ "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
|
11 \ " 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
|
12 \ " 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
|
13 \ " 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
|
14 \ " endwhile", |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 \ "endfunc", |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 \ "func! Foo3()", |
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! Bar()", |
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 \ "call Foo1()", |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 \ "call Foo1()", |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 \ "profile pause", |
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 continue", |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 \ "call Foo2()", |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 \ "call Foo3()", |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 \ "call Bar()", |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 \ "if !v:profiling", |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 \ " delfunc Foo2", |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 \ "endif", |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 \ "delfunc Foo3", |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 \ ] |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 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
|
35 call system(v:progpath |
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
|
36 \ . ' -es -u NONE -U NONE -i NONE --noplugin' |
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 \ . ' -c "profile start Xprofile_func.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
|
38 \ . ' -c "profile func Foo*"' |
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]) |
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
|
70 call assert_match('^\s*100\s\+.*\sendwhile$', lines[16]) |
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 |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 func Test_profile_file() |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 let lines = [ |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 \ 'func! Foo()', |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 \ 'endfunc', |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 \ 'for i in range(10)', |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 \ ' " a comment', |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 \ ' call Foo()', |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 \ 'endfor', |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 \ 'call Foo()', |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 \ ] |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 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
|
99 call system(v:progpath |
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
|
100 \ . ' -es -u NONE -U NONE -i NONE --noplugin' |
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
|
101 \ . ' -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
|
102 \ . ' -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
|
103 \ . ' -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
|
104 \ . ' -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
|
105 \ . ' -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
|
106 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
|
107 |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 let lines = readfile('Xprofile_file.log') |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 call assert_equal(14, len(lines)) |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 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
|
113 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
|
114 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
|
115 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
|
116 call assert_equal('', lines[4]) |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 call assert_equal('count total (s) self (s)', lines[5]) |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 call assert_equal(' func! Foo()', lines[6]) |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 call assert_equal(' endfunc', lines[7]) |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 " 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
|
121 " 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
|
122 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
|
123 call assert_equal(' " a comment', lines[9]) |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 call assert_match('^\s*20\s\+\d\+\.\d\+\s\+\d\+\.\d\+\s\+call Foo()$', lines[10]) |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 call assert_match('^\s*20\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
|
126 " 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
|
127 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
|
128 call assert_equal('', lines[13]) |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
129 |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 call delete('Xprofile_file.vim') |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 call delete('Xprofile_file.log') |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 endfunc |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 func Test_profile_completion() |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 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
|
136 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
|
137 |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 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
|
139 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
|
140 endfunc |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 func Test_profile_errors() |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 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
|
144 call assert_fails("profile pause", 'E750:') |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 call assert_fails("profile continue", 'E750:') |
2748b23db6bb
patch 8.0.0189: profile commands are not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 endfunc |