annotate src/testdir/runtest.vim @ 8104:1a03abdc4234 v7.4.1346

commit https://github.com/vim/vim/commit/a1e24b9bc9123ff6dd23e3cac2287a4411ef5572 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Feb 18 20:18:09 2016 +0100 patch 7.4.1346 Problem: Compiler warnings in build with -O2. Solution: Add inintializations.
author Christian Brabandt <cb@256bit.org>
date Thu, 18 Feb 2016 20:30:04 +0100
parents 770dd91ad9f7
children 3c1bdf20c8b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " This script is sourced while editing the .vim file with the tests.
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 " When the script is successful the .res file will be created.
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 " Errors are appended to the test.log file.
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 "
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 " The test script may contain anything, only functions that start with
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 " "Test_" are special. These will be invoked and should contain assert
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 " functions. See test_assert.vim for an example.
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 "
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 " It is possible to source other files that contain "Test_" functions. This
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 " can speed up testing, since Vim does not need to restart. But be careful
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 " that the tests do not interfere with each other.
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 "
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 " If an error cannot be detected properly with an assert function add the
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 " error to the v:errors list:
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 " call add(v:errors, 'test foo failed: Cannot find xyz')
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 "
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 " If preparation for each Test_ function is needed, define a SetUp function.
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 " It will be called before each Test_ function.
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 "
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 " If cleanup after each Test_ function is needed, define a TearDown function.
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 " It will be called after each Test_ function.
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
22 "
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
23 " When debugging a test it can be useful to add messages to v:errors:
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
24 " call add(v:errors, "this happened")
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
25
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 " Without the +eval feature we can't run these tests, bail out.
7352
ddab7ae8796d commit https://github.com/vim/vim/commit/4686b323e4bc0f466500b018959f6c8965f010f9
Christian Brabandt <cb@256bit.org>
parents: 7295
diff changeset
28 so small.vim
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 " Check that the screen size is at least 24 x 80 characters.
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 if &lines < 24 || &columns < 80
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 let error = 'Screen size too small! Tests require at least 24 lines with 80 characters'
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 echoerr error
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 split test.log
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 $put =error
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 w
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 cquit
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 endif
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39
7391
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
40 " For consistency run all tests with 'nocompatible' set.
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
41 " This also enables use of line continuation.
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
42 set nocp viminfo+=nviminfo
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
43
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
44 " Avoid stopping at the "hit enter" prompt
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
45 set nomore
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
46
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
47 " Output all messages in English.
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
48 lang mess C
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
49
7623
2720952e9acb commit https://github.com/vim/vim/commit/f60b796fa9870bdfc4cdeb91653bac041916077d
Christian Brabandt <cb@256bit.org>
parents: 7595
diff changeset
50 " Always use forward slashes.
2720952e9acb commit https://github.com/vim/vim/commit/f60b796fa9870bdfc4cdeb91653bac041916077d
Christian Brabandt <cb@256bit.org>
parents: 7595
diff changeset
51 set shellslash
2720952e9acb commit https://github.com/vim/vim/commit/f60b796fa9870bdfc4cdeb91653bac041916077d
Christian Brabandt <cb@256bit.org>
parents: 7595
diff changeset
52
7545
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
53 let s:srcdir = expand('%:p:h:h')
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
54
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
55 " Support function: get the alloc ID by name.
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
56 function GetAllocId(name)
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
57 exe 'split ' . s:srcdir . '/alloc.h'
7595
99e93f72ff91 commit https://github.com/vim/vim/commit/065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0
Christian Brabandt <cb@256bit.org>
parents: 7545
diff changeset
58 let top = search('typedef enum')
99e93f72ff91 commit https://github.com/vim/vim/commit/065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0
Christian Brabandt <cb@256bit.org>
parents: 7545
diff changeset
59 if top == 0
99e93f72ff91 commit https://github.com/vim/vim/commit/065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0
Christian Brabandt <cb@256bit.org>
parents: 7545
diff changeset
60 call add(v:errors, 'typedef not found in alloc.h')
99e93f72ff91 commit https://github.com/vim/vim/commit/065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0
Christian Brabandt <cb@256bit.org>
parents: 7545
diff changeset
61 endif
7545
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
62 let lnum = search('aid_' . a:name . ',')
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
63 if lnum == 0
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
64 call add(v:errors, 'Alloc ID ' . a:name . ' not defined')
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
65 endif
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
66 close
7595
99e93f72ff91 commit https://github.com/vim/vim/commit/065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0
Christian Brabandt <cb@256bit.org>
parents: 7545
diff changeset
67 return lnum - top - 1
7545
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
68 endfunc
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
69
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
70
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 " Source the test script. First grab the file name, in case the script
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
72 " navigates away. g:testname can be used by the tests.
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
73 let g:testname = expand('%')
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
74 let s:done = 0
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
75 let s:fail = 0
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
76 let s:errors = []
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
77 let s:messages = []
7454
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
78 if expand('%') =~ 'test_viml.vim'
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
79 " this test has intentional s:errors, don't use try/catch.
7352
ddab7ae8796d commit https://github.com/vim/vim/commit/4686b323e4bc0f466500b018959f6c8965f010f9
Christian Brabandt <cb@256bit.org>
parents: 7295
diff changeset
80 source %
7454
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
81 else
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
82 try
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
83 source %
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
84 catch
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
85 let s:fail += 1
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
86 call add(s:errors, 'Caught exception: ' . v:exception . ' @ ' . v:throwpoint)
7454
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
87 endtry
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
88 endif
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 " Locate Test_ functions and execute them.
7637
81f94c1e2e4d commit https://github.com/vim/vim/commit/a99b90437af730dcafd9143c0942c87777a00d52
Christian Brabandt <cb@256bit.org>
parents: 7623
diff changeset
91 set nomore
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 redir @q
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 function /^Test_
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 redir END
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
95 let s:tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g'))
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96
7540
b910bb01832a commit https://github.com/vim/vim/commit/cfc0a350a9fa04f1b0cfa1ba31fbd2847376513f
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
97 " Execute the tests in alphabetical order.
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
98 for s:test in sort(s:tests)
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 if exists("*SetUp")
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 call SetUp()
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 endif
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
103 call add(s:messages, 'Executing ' . s:test)
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
104 let s:done += 1
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 try
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
106 exe 'call ' . s:test
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 catch
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
108 call add(v:errors, 'Caught exception in ' . s:test . ': ' . v:exception . ' @ ' . v:throwpoint)
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 endtry
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 if len(v:errors) > 0
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
112 let s:fail += 1
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
113 call add(s:errors, 'Found errors in ' . s:test . ':')
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
114 call extend(s:errors, v:errors)
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 let v:errors = []
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 endif
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 if exists("*TearDown")
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 call TearDown()
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 endif
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 endfor
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
123 if s:fail == 0
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 " Success, create the .res file so that make knows it's done.
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
125 exe 'split ' . fnamemodify(g:testname, ':r') . '.res'
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 write
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 endif
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
129 if len(s:errors) > 0
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 " Append errors to test.log
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 split test.log
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 call append(line('$'), '')
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
133 call append(line('$'), 'From ' . g:testname . ':')
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
134 call append(line('$'), s:errors)
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 write
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 endif
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
138 let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test')
7372
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
139 echo message
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
140 call add(s:messages, message)
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
141 if s:fail > 0
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
142 let message = s:fail . ' FAILED:'
7372
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
143 echo message
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
144 call add(s:messages, message)
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
145 call extend(s:messages, s:errors)
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 endif
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147
7372
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
148 " Append messages to "messages"
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
149 split messages
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
150 call append(line('$'), '')
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
151 call append(line('$'), 'From ' . g:testname . ':')
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
152 call append(line('$'), s:messages)
7372
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
153 write
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
154
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 qall!