annotate src/testdir/runtest.vim @ 7637:81f94c1e2e4d v7.4.1118

commit https://github.com/vim/vim/commit/a99b90437af730dcafd9143c0942c87777a00d52 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 17 17:10:59 2016 +0100 patch 7.4.1118 Problem: Tests hang in 24 line terminal. Solution: Set the 'more' option off.
author Christian Brabandt <cb@256bit.org>
date Sun, 17 Jan 2016 17:15:05 +0100
parents 2720952e9acb
children 770dd91ad9f7
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.
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 " 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
24 so small.vim
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 " 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
27 if &lines < 24 || &columns < 80
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 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
29 echoerr error
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 split test.log
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 $put =error
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 w
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 cquit
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 endif
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35
7391
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
36 " 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
37 " 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
38 set nocp viminfo+=nviminfo
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
39
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
40 " 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
41 set nomore
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
42
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
43 " Output all messages in English.
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
44 lang mess C
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
45
7623
2720952e9acb commit https://github.com/vim/vim/commit/f60b796fa9870bdfc4cdeb91653bac041916077d
Christian Brabandt <cb@256bit.org>
parents: 7595
diff changeset
46 " Always use forward slashes.
2720952e9acb commit https://github.com/vim/vim/commit/f60b796fa9870bdfc4cdeb91653bac041916077d
Christian Brabandt <cb@256bit.org>
parents: 7595
diff changeset
47 set shellslash
2720952e9acb commit https://github.com/vim/vim/commit/f60b796fa9870bdfc4cdeb91653bac041916077d
Christian Brabandt <cb@256bit.org>
parents: 7595
diff changeset
48
7545
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
49 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
50
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
51 " 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
52 function GetAllocId(name)
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
53 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
54 let top = search('typedef enum')
99e93f72ff91 commit https://github.com/vim/vim/commit/065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0
Christian Brabandt <cb@256bit.org>
parents: 7545
diff changeset
55 if top == 0
99e93f72ff91 commit https://github.com/vim/vim/commit/065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0
Christian Brabandt <cb@256bit.org>
parents: 7545
diff changeset
56 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
57 endif
7545
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
58 let lnum = search('aid_' . a:name . ',')
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
59 if lnum == 0
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
60 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
61 endif
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
62 close
7595
99e93f72ff91 commit https://github.com/vim/vim/commit/065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0
Christian Brabandt <cb@256bit.org>
parents: 7545
diff changeset
63 return lnum - top - 1
7545
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
64 endfunc
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
65
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
66
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 " Source the test script. First grab the file name, in case the script
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 " navigates away.
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 let testname = expand('%')
7352
ddab7ae8796d commit https://github.com/vim/vim/commit/4686b323e4bc0f466500b018959f6c8965f010f9
Christian Brabandt <cb@256bit.org>
parents: 7295
diff changeset
70 let done = 0
ddab7ae8796d commit https://github.com/vim/vim/commit/4686b323e4bc0f466500b018959f6c8965f010f9
Christian Brabandt <cb@256bit.org>
parents: 7295
diff changeset
71 let fail = 0
ddab7ae8796d commit https://github.com/vim/vim/commit/4686b323e4bc0f466500b018959f6c8965f010f9
Christian Brabandt <cb@256bit.org>
parents: 7295
diff changeset
72 let errors = []
7372
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
73 let messages = []
7454
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
74 if expand('%') =~ 'test_viml.vim'
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
75 " this test has intentional 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
76 source %
7454
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
77 else
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
78 try
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
79 source %
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
80 catch
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
81 let fail += 1
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
82 call add(errors, 'Caught exception: ' . v:exception . ' @ ' . v:throwpoint)
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
83 endtry
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
84 endif
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 " 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
87 set nomore
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 redir @q
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 function /^Test_
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 redir END
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 let tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g'))
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92
7540
b910bb01832a commit https://github.com/vim/vim/commit/cfc0a350a9fa04f1b0cfa1ba31fbd2847376513f
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
93 " Execute the tests in alphabetical order.
b910bb01832a commit https://github.com/vim/vim/commit/cfc0a350a9fa04f1b0cfa1ba31fbd2847376513f
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
94 for test in sort(tests)
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 if exists("*SetUp")
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 call SetUp()
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 endif
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98
7372
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
99 call add(messages, 'Executing ' . test)
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 let done += 1
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 try
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 exe 'call ' . test
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 catch
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 let fail += 1
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 call add(v:errors, 'Caught exception in ' . test . ': ' . v:exception . ' @ ' . v:throwpoint)
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 endtry
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 if len(v:errors) > 0
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 let fail += 1
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 call add(errors, 'Found errors in ' . test . ':')
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 call extend(errors, v:errors)
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 let v:errors = []
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 endif
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 if exists("*TearDown")
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 call TearDown()
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 endif
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 endfor
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 if fail == 0
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 " Success, create the .res file so that make knows it's done.
7295
6922fcadafe6 commit https://github.com/vim/vim/commit/de0ad40cb3c1bc691a754698ed16a5b6cdb4086b
Christian Brabandt <cb@256bit.org>
parents: 7277
diff changeset
122 exe 'split ' . fnamemodify(testname, ':r') . '.res'
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 write
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 endif
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 if len(errors) > 0
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 " Append errors to test.log
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 split test.log
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 call append(line('$'), '')
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 call append(line('$'), 'From ' . testname . ':')
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 call append(line('$'), errors)
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 write
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 endif
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134
7372
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
135 let message = 'Executed ' . done . (done > 1 ? ' tests': ' test')
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
136 echo message
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
137 call add(messages, message)
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 if fail > 0
7372
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
139 let message = fail . ' FAILED'
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
140 echo message
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
141 call add(messages, message)
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 endif
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143
7372
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
144 " Append messages to "messages"
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
145 split messages
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
146 call append(line('$'), '')
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
147 call append(line('$'), 'From ' . testname . ':')
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
148 call append(line('$'), messages)
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
149 write
6b057079a836 commit https://github.com/vim/vim/commit/096c8bb40d51b22a4b1d761baf7bb79fb9e55a28
Christian Brabandt <cb@256bit.org>
parents: 7352
diff changeset
150
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 qall!