annotate src/testdir/runtest.vim @ 32136:50e447c67247 v9.0.1399

patch 9.0.1399: highlight test script has a few problems Commit: https://github.com/vim/vim/commit/4df0772a41c361a1c40d220f6fad0b1e1653fc5b Author: lagygoill <lacygoill@lacygoill.me> Date: Fri Mar 10 18:37:11 2023 +0000 patch 9.0.1399: highlight test script has a few problems Problem: Highlight test script has a few problems. Solution: Rewrite the script in Vim9 syntax. (closes https://github.com/vim/vim/issues/10379)
author Bram Moolenaar <Bram@vim.org>
date Fri, 10 Mar 2023 19:45:05 +0100
parents dbec60b8c253
children 36519954bf67
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 "
8142
71aabce3142e commit https://github.com/vim/vim/commit/befb366affa6309c6b4a469ec7f729821e3a36fa
Christian Brabandt <cb@256bit.org>
parents: 8116
diff changeset
5 " To execute only specific test functions, add a second argument. It will be
18748
c7b16393c248 patch 8.1.2364: termwinscroll test is flaky on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents: 18691
diff changeset
6 " matched against the names of the Test_ function. E.g.:
8142
71aabce3142e commit https://github.com/vim/vim/commit/befb366affa6309c6b4a469ec7f729821e3a36fa
Christian Brabandt <cb@256bit.org>
parents: 8116
diff changeset
7 " ../vim -u NONE -S runtest.vim test_channel.vim open_delay
71aabce3142e commit https://github.com/vim/vim/commit/befb366affa6309c6b4a469ec7f729821e3a36fa
Christian Brabandt <cb@256bit.org>
parents: 8116
diff changeset
8 " The output can be found in the "messages" file.
71aabce3142e commit https://github.com/vim/vim/commit/befb366affa6309c6b4a469ec7f729821e3a36fa
Christian Brabandt <cb@256bit.org>
parents: 8116
diff changeset
9 "
19734
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
10 " If the environment variable $TEST_FILTER is set then only test functions
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
11 " matching this pattern are executed. E.g. for sh/bash:
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
12 " export TEST_FILTER=Test_channel
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
13 " For csh:
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
14 " setenv TEST_FILTER Test_channel
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
15 "
25549
dc25589bfec0 patch 8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Bram Moolenaar <Bram@vim.org>
parents: 24194
diff changeset
16 " If the environment variable $TEST_SKIP_PAT is set then test functions
dc25589bfec0 patch 8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Bram Moolenaar <Bram@vim.org>
parents: 24194
diff changeset
17 " matching this pattern will be skipped. It's the opposite of $TEST_FILTER.
dc25589bfec0 patch 8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Bram Moolenaar <Bram@vim.org>
parents: 24194
diff changeset
18 "
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 21433
diff changeset
19 " While working on a test you can make $TEST_NO_RETRY non-empty to not retry:
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 21433
diff changeset
20 " export TEST_NO_RETRY=yes
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 21433
diff changeset
21 "
19734
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
22 " To ignore failure for tests that are known to fail in a certain environment,
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
23 " set $TEST_MAY_FAIL to a comma separated list of function names. E.g. for
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
24 " sh/bash:
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
25 " export TEST_MAY_FAIL=Test_channel_one,Test_channel_other
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
26 " The failure report will then not be included in the test.log file and
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
27 " "make test" will not fail.
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
28 "
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 " 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
30 " "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
31 " 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
32 "
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 " 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
34 " 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
35 " 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
36 "
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 " 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
38 " error to the v:errors list:
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 " 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
40 "
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 " 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
42 " 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
43 "
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 " 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
45 " 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
46 "
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
47 " When debugging a test it can be useful to add messages to v:errors:
15377
88b0a490816e patch 8.1.0696: when test_edit fails 'insertmode' may not be reset
Bram Moolenaar <Bram@vim.org>
parents: 15180
diff changeset
48 " call add(v:errors, "this happened")
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
49
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 " Without the +eval feature we can't run these tests, bail out.
21779
30bdd2e4a6f9 patch 8.2.1439: tiny and small builds have no test coverage
Bram Moolenaar <Bram@vim.org>
parents: 21668
diff changeset
52 silent! while 0
30bdd2e4a6f9 patch 8.2.1439: tiny and small builds have no test coverage
Bram Moolenaar <Bram@vim.org>
parents: 21668
diff changeset
53 qa!
30bdd2e4a6f9 patch 8.2.1439: tiny and small builds have no test coverage
Bram Moolenaar <Bram@vim.org>
parents: 21668
diff changeset
54 silent! endwhile
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 20963
diff changeset
56 " In the GUI we can always change the screen size.
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 20963
diff changeset
57 if has('gui_running')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 20963
diff changeset
58 set columns=80 lines=25
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 20963
diff changeset
59 endif
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 20963
diff changeset
60
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 " Check that the screen size is at least 24 x 80 characters.
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31402
diff changeset
62 if &lines < 24 || &columns < 80
17684
e2bfdd281578 patch 8.1.1839: insufficient info when test fails because of screen size
Bram Moolenaar <Bram@vim.org>
parents: 17356
diff changeset
63 let error = 'Screen size too small! Tests require at least 24 lines with 80 characters, got ' .. &lines .. ' lines with ' .. &columns .. ' characters'
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 echoerr error
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 split test.log
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 $put =error
17091
d30d399139ab patch 8.1.1545: when the screen is to small there is no message about that
Bram Moolenaar <Bram@vim.org>
parents: 17032
diff changeset
67 write
d30d399139ab patch 8.1.1545: when the screen is to small there is no message about that
Bram Moolenaar <Bram@vim.org>
parents: 17032
diff changeset
68 split messages
17684
e2bfdd281578 patch 8.1.1839: insufficient info when test fails because of screen size
Bram Moolenaar <Bram@vim.org>
parents: 17356
diff changeset
69 call append(line('$'), '')
e2bfdd281578 patch 8.1.1839: insufficient info when test fails because of screen size
Bram Moolenaar <Bram@vim.org>
parents: 17356
diff changeset
70 call append(line('$'), 'From ' . expand('%') . ':')
17091
d30d399139ab patch 8.1.1545: when the screen is to small there is no message about that
Bram Moolenaar <Bram@vim.org>
parents: 17032
diff changeset
71 call append(line('$'), error)
d30d399139ab patch 8.1.1545: when the screen is to small there is no message about that
Bram Moolenaar <Bram@vim.org>
parents: 17032
diff changeset
72 write
d30d399139ab patch 8.1.1545: when the screen is to small there is no message about that
Bram Moolenaar <Bram@vim.org>
parents: 17032
diff changeset
73 qa!
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 endif
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75
16967
586d625e21b4 patch 8.1.1484: some tests are slow
Bram Moolenaar <Bram@vim.org>
parents: 16951
diff changeset
76 if has('reltime')
30449
55aa44dd59ef patch 9.0.0560: elapsed time since testing started is not visible
Bram Moolenaar <Bram@vim.org>
parents: 30419
diff changeset
77 let s:run_start_time = reltime()
55aa44dd59ef patch 9.0.0560: elapsed time since testing started is not visible
Bram Moolenaar <Bram@vim.org>
parents: 30419
diff changeset
78
55aa44dd59ef patch 9.0.0560: elapsed time since testing started is not visible
Bram Moolenaar <Bram@vim.org>
parents: 30419
diff changeset
79 if !filereadable('starttime')
55aa44dd59ef patch 9.0.0560: elapsed time since testing started is not visible
Bram Moolenaar <Bram@vim.org>
parents: 30419
diff changeset
80 " first test, store the overall test starting time
55aa44dd59ef patch 9.0.0560: elapsed time since testing started is not visible
Bram Moolenaar <Bram@vim.org>
parents: 30419
diff changeset
81 let s:test_start_time = localtime()
55aa44dd59ef patch 9.0.0560: elapsed time since testing started is not visible
Bram Moolenaar <Bram@vim.org>
parents: 30419
diff changeset
82 call writefile([string(s:test_start_time)], 'starttime')
55aa44dd59ef patch 9.0.0560: elapsed time since testing started is not visible
Bram Moolenaar <Bram@vim.org>
parents: 30419
diff changeset
83 else
55aa44dd59ef patch 9.0.0560: elapsed time since testing started is not visible
Bram Moolenaar <Bram@vim.org>
parents: 30419
diff changeset
84 " second or later test, read the overall test starting time
55aa44dd59ef patch 9.0.0560: elapsed time since testing started is not visible
Bram Moolenaar <Bram@vim.org>
parents: 30419
diff changeset
85 let s:test_start_time = readfile('starttime')[0]->str2nr()
55aa44dd59ef patch 9.0.0560: elapsed time since testing started is not visible
Bram Moolenaar <Bram@vim.org>
parents: 30419
diff changeset
86 endif
16967
586d625e21b4 patch 8.1.1484: some tests are slow
Bram Moolenaar <Bram@vim.org>
parents: 16951
diff changeset
87 endif
586d625e21b4 patch 8.1.1484: some tests are slow
Bram Moolenaar <Bram@vim.org>
parents: 16951
diff changeset
88
26500
8088fa133b93 patch 8.2.3780: ":cd" works differently on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
89 " Always use forward slashes.
8088fa133b93 patch 8.2.3780: ":cd" works differently on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
90 set shellslash
8088fa133b93 patch 8.2.3780: ":cd" works differently on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
91
9501
f0201deac2a2 commit https://github.com/vim/vim/commit/89b10421ca1aea55acbafac1df93be4e20210ceb
Christian Brabandt <cb@256bit.org>
parents: 9452
diff changeset
92 " Common with all tests on all systems.
f0201deac2a2 commit https://github.com/vim/vim/commit/89b10421ca1aea55acbafac1df93be4e20210ceb
Christian Brabandt <cb@256bit.org>
parents: 9452
diff changeset
93 source setup.vim
f0201deac2a2 commit https://github.com/vim/vim/commit/89b10421ca1aea55acbafac1df93be4e20210ceb
Christian Brabandt <cb@256bit.org>
parents: 9452
diff changeset
94
7391
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
95 " 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
96 " 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
97 set nocp viminfo+=nviminfo
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
98
15607
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15377
diff changeset
99 " Use utf-8 by default, instead of whatever the system default happens to be.
15928
857ce36c8412 patch 8.1.0970: text properties test fails when 'encoding' is not utf-8
Bram Moolenaar <Bram@vim.org>
parents: 15920
diff changeset
100 " Individual tests can overrule this at the top of the file and use
857ce36c8412 patch 8.1.0970: text properties test fails when 'encoding' is not utf-8
Bram Moolenaar <Bram@vim.org>
parents: 15920
diff changeset
101 " g:orig_encoding if needed.
857ce36c8412 patch 8.1.0970: text properties test fails when 'encoding' is not utf-8
Bram Moolenaar <Bram@vim.org>
parents: 15920
diff changeset
102 let g:orig_encoding = &encoding
15607
2dcaa860e3fc patch 8.1.0811: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 15377
diff changeset
103 set encoding=utf-8
9618
81ba6e4eb72b commit https://github.com/vim/vim/commit/ac105ed3c420660ddbddc501c97875c48220817e
Christian Brabandt <cb@256bit.org>
parents: 9501
diff changeset
104
14889
ba1f0c06b4be patch 8.1.0456: running test hangs when the input file is being edited
Bram Moolenaar <Bram@vim.org>
parents: 14571
diff changeset
105 " REDIR_TEST_TO_NULL has a very permissive SwapExists autocommand which is for
ba1f0c06b4be patch 8.1.0456: running test hangs when the input file is being edited
Bram Moolenaar <Bram@vim.org>
parents: 14571
diff changeset
106 " the test_name.vim file itself. Replace it here with a more restrictive one,
ba1f0c06b4be patch 8.1.0456: running test hangs when the input file is being edited
Bram Moolenaar <Bram@vim.org>
parents: 14571
diff changeset
107 " so we still catch mistakes.
26092
6a0f603c52a9 patch 8.2.3579: CI sometimes fails for MinGW
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
108 if has("win32")
6a0f603c52a9 patch 8.2.3579: CI sometimes fails for MinGW
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
109 " replace any '/' directory separators by '\\'
6a0f603c52a9 patch 8.2.3579: CI sometimes fails for MinGW
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
110 let s:test_script_fname = substitute(expand('%'), '/', '\\', 'g')
6a0f603c52a9 patch 8.2.3579: CI sometimes fails for MinGW
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
111 else
6a0f603c52a9 patch 8.2.3579: CI sometimes fails for MinGW
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
112 let s:test_script_fname = expand('%')
6a0f603c52a9 patch 8.2.3579: CI sometimes fails for MinGW
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
113 endif
14889
ba1f0c06b4be patch 8.1.0456: running test hangs when the input file is being edited
Bram Moolenaar <Bram@vim.org>
parents: 14571
diff changeset
114 au! SwapExists * call HandleSwapExists()
ba1f0c06b4be patch 8.1.0456: running test hangs when the input file is being edited
Bram Moolenaar <Bram@vim.org>
parents: 14571
diff changeset
115 func HandleSwapExists()
21668
0843f244e547 patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents: 21530
diff changeset
116 if exists('g:ignoreSwapExists')
0843f244e547 patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents: 21530
diff changeset
117 return
0843f244e547 patch 8.2.1384: no ATTENTION prompt for :vimgrep first match file
Bram Moolenaar <Bram@vim.org>
parents: 21530
diff changeset
118 endif
17356
4fe44a3b732f patch 8.1.1677: tests get stuck when running into an existing swapfile
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
119 " Ignore finding a swap file for the test script (the user might be
14889
ba1f0c06b4be patch 8.1.0456: running test hangs when the input file is being edited
Bram Moolenaar <Bram@vim.org>
parents: 14571
diff changeset
120 " editing it and do ":make test_name") and the output file.
17356
4fe44a3b732f patch 8.1.1677: tests get stuck when running into an existing swapfile
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
121 " Report finding another swap file and chose 'q' to avoid getting stuck.
14889
ba1f0c06b4be patch 8.1.0456: running test hangs when the input file is being edited
Bram Moolenaar <Bram@vim.org>
parents: 14571
diff changeset
122 if expand('<afile>') == 'messages' || expand('<afile>') =~ s:test_script_fname
ba1f0c06b4be patch 8.1.0456: running test hangs when the input file is being edited
Bram Moolenaar <Bram@vim.org>
parents: 14571
diff changeset
123 let v:swapchoice = 'e'
17356
4fe44a3b732f patch 8.1.1677: tests get stuck when running into an existing swapfile
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
124 else
4fe44a3b732f patch 8.1.1677: tests get stuck when running into an existing swapfile
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
125 call assert_report('Unexpected swap file: ' .. v:swapname)
4fe44a3b732f patch 8.1.1677: tests get stuck when running into an existing swapfile
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
126 let v:swapchoice = 'q'
14889
ba1f0c06b4be patch 8.1.0456: running test hangs when the input file is being edited
Bram Moolenaar <Bram@vim.org>
parents: 14571
diff changeset
127 endif
ba1f0c06b4be patch 8.1.0456: running test hangs when the input file is being edited
Bram Moolenaar <Bram@vim.org>
parents: 14571
diff changeset
128 endfunc
ba1f0c06b4be patch 8.1.0456: running test hangs when the input file is being edited
Bram Moolenaar <Bram@vim.org>
parents: 14571
diff changeset
129
10811
4cb74eab1733 patch 8.0.0295: test_viml hangs
Christian Brabandt <cb@256bit.org>
parents: 10807
diff changeset
130 " Avoid stopping at the "hit enter" prompt
4cb74eab1733 patch 8.0.0295: test_viml hangs
Christian Brabandt <cb@256bit.org>
parents: 10807
diff changeset
131 set nomore
4cb74eab1733 patch 8.0.0295: test_viml hangs
Christian Brabandt <cb@256bit.org>
parents: 10807
diff changeset
132
7391
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
133 " Output all messages in English.
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
134 lang mess C
4761fed349ed commit https://github.com/vim/vim/commit/c06624661a3aa6642304c06db9cebe553a4cab17
Christian Brabandt <cb@256bit.org>
parents: 7372
diff changeset
135
21379
20dad734a2cb patch 8.2.1240: GUI tests sometimes fail because of translations
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
136 " suppress menu translation
20dad734a2cb patch 8.2.1240: GUI tests sometimes fail because of translations
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
137 if has('gui_running') && exists('did_install_default_menus')
20dad734a2cb patch 8.2.1240: GUI tests sometimes fail because of translations
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
138 source $VIMRUNTIME/delmenu.vim
20dad734a2cb patch 8.2.1240: GUI tests sometimes fail because of translations
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
139 set langmenu=none
20dad734a2cb patch 8.2.1240: GUI tests sometimes fail because of translations
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
140 source $VIMRUNTIME/menu.vim
20dad734a2cb patch 8.2.1240: GUI tests sometimes fail because of translations
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
141 endif
20dad734a2cb patch 8.2.1240: GUI tests sometimes fail because of translations
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
142
7545
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
143 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
144
21433
ad7ffbd3f02f patch 8.2.1267: MS-Windows: tests may fail due to $PROMPT value
Bram Moolenaar <Bram@vim.org>
parents: 21379
diff changeset
145 if has('win32')
ad7ffbd3f02f patch 8.2.1267: MS-Windows: tests may fail due to $PROMPT value
Bram Moolenaar <Bram@vim.org>
parents: 21379
diff changeset
146 " avoid prompt that is long or contains a line break
ad7ffbd3f02f patch 8.2.1267: MS-Windows: tests may fail due to $PROMPT value
Bram Moolenaar <Bram@vim.org>
parents: 21379
diff changeset
147 let $PROMPT = '$P$G'
21530
66f12838071d patch 8.2.1315: MS-Windows: test log contains escape sequences
Bram Moolenaar <Bram@vim.org>
parents: 21510
diff changeset
148 " On MS-Windows t_md and t_me are Vim specific escape sequences.
66f12838071d patch 8.2.1315: MS-Windows: test log contains escape sequences
Bram Moolenaar <Bram@vim.org>
parents: 21510
diff changeset
149 let s:t_bold = "\x1b[1m"
66f12838071d patch 8.2.1315: MS-Windows: test log contains escape sequences
Bram Moolenaar <Bram@vim.org>
parents: 21510
diff changeset
150 let s:t_normal = "\x1b[m"
66f12838071d patch 8.2.1315: MS-Windows: test log contains escape sequences
Bram Moolenaar <Bram@vim.org>
parents: 21510
diff changeset
151 else
66f12838071d patch 8.2.1315: MS-Windows: test log contains escape sequences
Bram Moolenaar <Bram@vim.org>
parents: 21510
diff changeset
152 let s:t_bold = &t_md
66f12838071d patch 8.2.1315: MS-Windows: test log contains escape sequences
Bram Moolenaar <Bram@vim.org>
parents: 21510
diff changeset
153 let s:t_normal = &t_me
21433
ad7ffbd3f02f patch 8.2.1267: MS-Windows: tests may fail due to $PROMPT value
Bram Moolenaar <Bram@vim.org>
parents: 21379
diff changeset
154 endif
ad7ffbd3f02f patch 8.2.1267: MS-Windows: tests may fail due to $PROMPT value
Bram Moolenaar <Bram@vim.org>
parents: 21379
diff changeset
155
22967
47a5349168ea patch 8.2.2030: some tests fail on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22480
diff changeset
156 if has('mac')
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 26092
diff changeset
157 " In macOS, when starting a shell in a terminal, a bash deprecation warning
22967
47a5349168ea patch 8.2.2030: some tests fail on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22480
diff changeset
158 " message is displayed. This breaks the terminal test. Disable the warning
47a5349168ea patch 8.2.2030: some tests fail on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22480
diff changeset
159 " message.
47a5349168ea patch 8.2.2030: some tests fail on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22480
diff changeset
160 let $BASH_SILENCE_DEPRECATION_WARNING = 1
47a5349168ea patch 8.2.2030: some tests fail on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22480
diff changeset
161 endif
47a5349168ea patch 8.2.2030: some tests fail on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22480
diff changeset
162
31347
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
163
9121
7350959e53c3 commit https://github.com/vim/vim/commit/8e8df251bf2505e5decf258397c6069fbe5e2e01
Christian Brabandt <cb@256bit.org>
parents: 8881
diff changeset
164 " Prepare for calling test_garbagecollect_now().
8881
ed0b39dd7fd6 commit https://github.com/vim/vim/commit/ebf7dfa6f121c82f97d2adca3d45fbaba9ad8f7e
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
165 let v:testing = 1
ed0b39dd7fd6 commit https://github.com/vim/vim/commit/ebf7dfa6f121c82f97d2adca3d45fbaba9ad8f7e
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
166
29340
fba9e366ced4 patch 9.0.0013: reproducing memory access errors can be difficult
Bram Moolenaar <Bram@vim.org>
parents: 29165
diff changeset
167 " By default, copy each buffer line into allocated memory, so that valgrind can
fba9e366ced4 patch 9.0.0013: reproducing memory access errors can be difficult
Bram Moolenaar <Bram@vim.org>
parents: 29165
diff changeset
168 " detect accessing memory before and after it.
fba9e366ced4 patch 9.0.0013: reproducing memory access errors can be difficult
Bram Moolenaar <Bram@vim.org>
parents: 29165
diff changeset
169 call test_override('alloc_lines', 1)
fba9e366ced4 patch 9.0.0013: reproducing memory access errors can be difficult
Bram Moolenaar <Bram@vim.org>
parents: 29165
diff changeset
170
7545
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
171 " 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
172 function GetAllocId(name)
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
173 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
174 let top = search('typedef enum')
99e93f72ff91 commit https://github.com/vim/vim/commit/065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0
Christian Brabandt <cb@256bit.org>
parents: 7545
diff changeset
175 if top == 0
99e93f72ff91 commit https://github.com/vim/vim/commit/065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0
Christian Brabandt <cb@256bit.org>
parents: 7545
diff changeset
176 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
177 endif
7545
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
178 let lnum = search('aid_' . a:name . ',')
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
179 if lnum == 0
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
180 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
181 endif
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
182 close
7595
99e93f72ff91 commit https://github.com/vim/vim/commit/065ee9aebf9abe08ae8c0dba7d05cbdcc423c8e0
Christian Brabandt <cb@256bit.org>
parents: 7545
diff changeset
183 return lnum - top - 1
7545
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
184 endfunc
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
185
30449
55aa44dd59ef patch 9.0.0560: elapsed time since testing started is not visible
Bram Moolenaar <Bram@vim.org>
parents: 30419
diff changeset
186 if has('reltime')
55aa44dd59ef patch 9.0.0560: elapsed time since testing started is not visible
Bram Moolenaar <Bram@vim.org>
parents: 30419
diff changeset
187 let g:func_start = reltime()
55aa44dd59ef patch 9.0.0560: elapsed time since testing started is not visible
Bram Moolenaar <Bram@vim.org>
parents: 30419
diff changeset
188 endif
30419
f652823ce8bb patch 9.0.0545: when a test is slow and CI times out there is no time info
Bram Moolenaar <Bram@vim.org>
parents: 30357
diff changeset
189
31347
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
190 " Get the list of swap files in the current directory.
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
191 func s:GetSwapFileList()
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
192 let save_dir = &directory
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
193 let &directory = '.'
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
194 let files = swapfilelist()
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
195 let &directory = save_dir
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
196
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
197 " remove a match with runtest.vim
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
198 let idx = indexof(files, 'v:val =~ "runtest.vim."')
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
199 if idx >= 0
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
200 call remove(files, idx)
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
201 endif
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
202
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
203 return files
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
204 endfunc
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
205
31373
513d8dcc03a5 patch 9.0.1020: tests call GetSwapFileList() before it is defined
Bram Moolenaar <Bram@vim.org>
parents: 31357
diff changeset
206 " A previous (failed) test run may have left swap files behind. Delete them
513d8dcc03a5 patch 9.0.1020: tests call GetSwapFileList() before it is defined
Bram Moolenaar <Bram@vim.org>
parents: 31357
diff changeset
207 " before running tests again, they might interfere.
513d8dcc03a5 patch 9.0.1020: tests call GetSwapFileList() before it is defined
Bram Moolenaar <Bram@vim.org>
parents: 31357
diff changeset
208 for name in s:GetSwapFileList()
513d8dcc03a5 patch 9.0.1020: tests call GetSwapFileList() before it is defined
Bram Moolenaar <Bram@vim.org>
parents: 31357
diff changeset
209 call delete(name)
513d8dcc03a5 patch 9.0.1020: tests call GetSwapFileList() before it is defined
Bram Moolenaar <Bram@vim.org>
parents: 31357
diff changeset
210 endfor
31375
2fa45dcb9d87 patch 9.0.1021: test trips over g:name
Bram Moolenaar <Bram@vim.org>
parents: 31373
diff changeset
211 unlet name
31373
513d8dcc03a5 patch 9.0.1020: tests call GetSwapFileList() before it is defined
Bram Moolenaar <Bram@vim.org>
parents: 31357
diff changeset
212
513d8dcc03a5 patch 9.0.1020: tests call GetSwapFileList() before it is defined
Bram Moolenaar <Bram@vim.org>
parents: 31357
diff changeset
213
30451
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
214 " Invoked when a test takes too much time.
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
215 func TestTimeout(id)
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
216 split test.log
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
217 call append(line('$'), '')
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
218 call append(line('$'), 'Test timed out: ' .. g:testfunc)
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
219 write
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
220 call add(v:errors, 'Test timed out: ' . g:testfunc)
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
221
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
222 cquit! 42
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
223 endfunc
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
224
11181
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
225 func RunTheTest(test)
30419
f652823ce8bb patch 9.0.0545: when a test is slow and CI times out there is no time info
Bram Moolenaar <Bram@vim.org>
parents: 30357
diff changeset
226 let prefix = ''
16967
586d625e21b4 patch 8.1.1484: some tests are slow
Bram Moolenaar <Bram@vim.org>
parents: 16951
diff changeset
227 if has('reltime')
30449
55aa44dd59ef patch 9.0.0560: elapsed time since testing started is not visible
Bram Moolenaar <Bram@vim.org>
parents: 30419
diff changeset
228 let prefix = strftime('%M:%S', localtime() - s:test_start_time) .. ' '
30419
f652823ce8bb patch 9.0.0545: when a test is slow and CI times out there is no time info
Bram Moolenaar <Bram@vim.org>
parents: 30357
diff changeset
229 let g:func_start = reltime()
16967
586d625e21b4 patch 8.1.1484: some tests are slow
Bram Moolenaar <Bram@vim.org>
parents: 16951
diff changeset
230 endif
30419
f652823ce8bb patch 9.0.0545: when a test is slow and CI times out there is no time info
Bram Moolenaar <Bram@vim.org>
parents: 30357
diff changeset
231 echoconsole prefix .. 'Executing ' .. a:test
10807
82c43bca568e patch 8.0.0293: some tests have a one or three second wait
Christian Brabandt <cb@256bit.org>
parents: 10797
diff changeset
232
30451
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
233 if has('timers')
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
234 " No test should take longer than 30 seconds. If it takes longer we
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
235 " assume we are stuck and need to break out.
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
236 let test_timeout_timer = timer_start(30000, 'TestTimeout')
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
237 endif
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
238
10807
82c43bca568e patch 8.0.0293: some tests have a one or three second wait
Christian Brabandt <cb@256bit.org>
parents: 10797
diff changeset
239 " Avoid stopping at the "hit enter" prompt
82c43bca568e patch 8.0.0293: some tests have a one or three second wait
Christian Brabandt <cb@256bit.org>
parents: 10797
diff changeset
240 set nomore
82c43bca568e patch 8.0.0293: some tests have a one or three second wait
Christian Brabandt <cb@256bit.org>
parents: 10797
diff changeset
241
82c43bca568e patch 8.0.0293: some tests have a one or three second wait
Christian Brabandt <cb@256bit.org>
parents: 10797
diff changeset
242 " Avoid a three second wait when a message is about to be overwritten by the
82c43bca568e patch 8.0.0293: some tests have a one or three second wait
Christian Brabandt <cb@256bit.org>
parents: 10797
diff changeset
243 " mode message.
82c43bca568e patch 8.0.0293: some tests have a one or three second wait
Christian Brabandt <cb@256bit.org>
parents: 10797
diff changeset
244 set noshowmode
82c43bca568e patch 8.0.0293: some tests have a one or three second wait
Christian Brabandt <cb@256bit.org>
parents: 10797
diff changeset
245
29340
fba9e366ced4 patch 9.0.0013: reproducing memory access errors can be difficult
Bram Moolenaar <Bram@vim.org>
parents: 29165
diff changeset
246 " Clear any overrides, except "alloc_lines".
11105
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents: 11056
diff changeset
247 call test_override('ALL', 0)
7c7e496e625d patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents: 11056
diff changeset
248
12692
03a6aeea2096 patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents: 12688
diff changeset
249 " Some tests wipe out buffers. To be consistent, always wipe out all
03a6aeea2096 patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents: 12688
diff changeset
250 " buffers.
03a6aeea2096 patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents: 12688
diff changeset
251 %bwipe!
03a6aeea2096 patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents: 12688
diff changeset
252
12851
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12769
diff changeset
253 " The test may change the current directory. Save and restore the
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12769
diff changeset
254 " directory after executing the test.
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12769
diff changeset
255 let save_cwd = getcwd()
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12769
diff changeset
256
8370
cd7ea16d1300 commit https://github.com/vim/vim/commit/b5760a1ce5b700fc32b8bd11948ee189a847c59e
Christian Brabandt <cb@256bit.org>
parents: 8142
diff changeset
257 if exists("*SetUp")
10388
6cdb0226d74a commit https://github.com/vim/vim/commit/cc28e2d05d05552d8b72a520be8a193f3d9822d4
Christian Brabandt <cb@256bit.org>
parents: 10229
diff changeset
258 try
6cdb0226d74a commit https://github.com/vim/vim/commit/cc28e2d05d05552d8b72a520be8a193f3d9822d4
Christian Brabandt <cb@256bit.org>
parents: 10229
diff changeset
259 call SetUp()
6cdb0226d74a commit https://github.com/vim/vim/commit/cc28e2d05d05552d8b72a520be8a193f3d9822d4
Christian Brabandt <cb@256bit.org>
parents: 10229
diff changeset
260 catch
6cdb0226d74a commit https://github.com/vim/vim/commit/cc28e2d05d05552d8b72a520be8a193f3d9822d4
Christian Brabandt <cb@256bit.org>
parents: 10229
diff changeset
261 call add(v:errors, 'Caught exception in SetUp() before ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint)
6cdb0226d74a commit https://github.com/vim/vim/commit/cc28e2d05d05552d8b72a520be8a193f3d9822d4
Christian Brabandt <cb@256bit.org>
parents: 10229
diff changeset
262 endtry
8370
cd7ea16d1300 commit https://github.com/vim/vim/commit/b5760a1ce5b700fc32b8bd11948ee189a847c59e
Christian Brabandt <cb@256bit.org>
parents: 8142
diff changeset
263 endif
cd7ea16d1300 commit https://github.com/vim/vim/commit/b5760a1ce5b700fc32b8bd11948ee189a847c59e
Christian Brabandt <cb@256bit.org>
parents: 8142
diff changeset
264
29165
0e0e298e05c1 patch 8.2.5102: interrupt not caught in test
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
265 au VimLeavePre * call EarlyExit(g:testfunc)
12682
47f253caa805 patch 8.0.1219: terminal test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
266 if a:test =~ 'Test_nocatch_'
47f253caa805 patch 8.0.1219: terminal test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
267 " Function handles errors itself. This avoids skipping commands after the
47f253caa805 patch 8.0.1219: terminal test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
268 " error.
24095
467c3022fba6 patch 8.2.2589: recover test hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 22967
diff changeset
269 let g:skipped_reason = ''
8370
cd7ea16d1300 commit https://github.com/vim/vim/commit/b5760a1ce5b700fc32b8bd11948ee189a847c59e
Christian Brabandt <cb@256bit.org>
parents: 8142
diff changeset
270 exe 'call ' . a:test
24095
467c3022fba6 patch 8.2.2589: recover test hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 22967
diff changeset
271 if g:skipped_reason != ''
467c3022fba6 patch 8.2.2589: recover test hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 22967
diff changeset
272 call add(s:messages, ' Skipped')
467c3022fba6 patch 8.2.2589: recover test hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 22967
diff changeset
273 call add(s:skipped, 'SKIPPED ' . a:test . ': ' . g:skipped_reason)
467c3022fba6 patch 8.2.2589: recover test hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 22967
diff changeset
274 endif
12682
47f253caa805 patch 8.0.1219: terminal test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
275 else
47f253caa805 patch 8.0.1219: terminal test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
276 try
47f253caa805 patch 8.0.1219: terminal test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
277 exe 'call ' . a:test
47f253caa805 patch 8.0.1219: terminal test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
278 catch /^\cskipped/
47f253caa805 patch 8.0.1219: terminal test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
279 call add(s:messages, ' Skipped')
47f253caa805 patch 8.0.1219: terminal test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
280 call add(s:skipped, 'SKIPPED ' . a:test . ': ' . substitute(v:exception, '^\S*\s\+', '', ''))
47f253caa805 patch 8.0.1219: terminal test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
281 catch
47f253caa805 patch 8.0.1219: terminal test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
282 call add(v:errors, 'Caught exception in ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint)
47f253caa805 patch 8.0.1219: terminal test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
283 endtry
47f253caa805 patch 8.0.1219: terminal test is flaky
Christian Brabandt <cb@256bit.org>
parents: 12616
diff changeset
284 endif
29165
0e0e298e05c1 patch 8.2.5102: interrupt not caught in test
Bram Moolenaar <Bram@vim.org>
parents: 29148
diff changeset
285 au! VimLeavePre
8370
cd7ea16d1300 commit https://github.com/vim/vim/commit/b5760a1ce5b700fc32b8bd11948ee189a847c59e
Christian Brabandt <cb@256bit.org>
parents: 8142
diff changeset
286
30357
2f295612c46a patch 9.0.0514: terminal test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
287 if a:test =~ '_terminal_'
2f295612c46a patch 9.0.0514: terminal test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
288 " Terminal tests sometimes hang, give extra information
2f295612c46a patch 9.0.0514: terminal test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
289 echoconsole 'After executing ' .. a:test
2f295612c46a patch 9.0.0514: terminal test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
290 endif
2f295612c46a patch 9.0.0514: terminal test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
291
15377
88b0a490816e patch 8.1.0696: when test_edit fails 'insertmode' may not be reset
Bram Moolenaar <Bram@vim.org>
parents: 15180
diff changeset
292 " In case 'insertmode' was set and something went wrong, make sure it is
88b0a490816e patch 8.1.0696: when test_edit fails 'insertmode' may not be reset
Bram Moolenaar <Bram@vim.org>
parents: 15180
diff changeset
293 " reset to avoid trouble with anything else.
88b0a490816e patch 8.1.0696: when test_edit fails 'insertmode' may not be reset
Bram Moolenaar <Bram@vim.org>
parents: 15180
diff changeset
294 set noinsertmode
88b0a490816e patch 8.1.0696: when test_edit fails 'insertmode' may not be reset
Bram Moolenaar <Bram@vim.org>
parents: 15180
diff changeset
295
8370
cd7ea16d1300 commit https://github.com/vim/vim/commit/b5760a1ce5b700fc32b8bd11948ee189a847c59e
Christian Brabandt <cb@256bit.org>
parents: 8142
diff changeset
296 if exists("*TearDown")
10388
6cdb0226d74a commit https://github.com/vim/vim/commit/cc28e2d05d05552d8b72a520be8a193f3d9822d4
Christian Brabandt <cb@256bit.org>
parents: 10229
diff changeset
297 try
6cdb0226d74a commit https://github.com/vim/vim/commit/cc28e2d05d05552d8b72a520be8a193f3d9822d4
Christian Brabandt <cb@256bit.org>
parents: 10229
diff changeset
298 call TearDown()
6cdb0226d74a commit https://github.com/vim/vim/commit/cc28e2d05d05552d8b72a520be8a193f3d9822d4
Christian Brabandt <cb@256bit.org>
parents: 10229
diff changeset
299 catch
6cdb0226d74a commit https://github.com/vim/vim/commit/cc28e2d05d05552d8b72a520be8a193f3d9822d4
Christian Brabandt <cb@256bit.org>
parents: 10229
diff changeset
300 call add(v:errors, 'Caught exception in TearDown() after ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint)
6cdb0226d74a commit https://github.com/vim/vim/commit/cc28e2d05d05552d8b72a520be8a193f3d9822d4
Christian Brabandt <cb@256bit.org>
parents: 10229
diff changeset
301 endtry
8370
cd7ea16d1300 commit https://github.com/vim/vim/commit/b5760a1ce5b700fc32b8bd11948ee189a847c59e
Christian Brabandt <cb@256bit.org>
parents: 8142
diff changeset
302 endif
9748
5440f3442841 commit https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5
Christian Brabandt <cb@256bit.org>
parents: 9632
diff changeset
303
30451
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
304 if has('timers')
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
305 call timer_stop(test_timeout_timer)
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
306 endif
c9d72c379cec patch 9.0.0561: when a test gets stuck it just hangs forever
Bram Moolenaar <Bram@vim.org>
parents: 30449
diff changeset
307
17684
e2bfdd281578 patch 8.1.1839: insufficient info when test fails because of screen size
Bram Moolenaar <Bram@vim.org>
parents: 17356
diff changeset
308 " Clear any autocommands and put back the catch-all for SwapExists.
12692
03a6aeea2096 patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents: 12688
diff changeset
309 au!
14889
ba1f0c06b4be patch 8.1.0456: running test hangs when the input file is being edited
Bram Moolenaar <Bram@vim.org>
parents: 14571
diff changeset
310 au SwapExists * call HandleSwapExists()
12692
03a6aeea2096 patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents: 12688
diff changeset
311
20386
3b3589275ab9 patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents: 20384
diff changeset
312 " Check for and close any stray popup windows.
18763
49b78d6465e5 patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18748
diff changeset
313 if has('popupwin')
29587
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29387
diff changeset
314 call assert_equal([], popup_list(), 'Popup is still present')
20384
42ab4d40e78f patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents: 20087
diff changeset
315 call popup_clear(1)
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17091
diff changeset
316 endif
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17091
diff changeset
317
29128
d8a962d7b008 patch 8.2.5084: when the GUI shows a dialog tests get stuck
Bram Moolenaar <Bram@vim.org>
parents: 28148
diff changeset
318 if filereadable('guidialogfile')
29148
8e87a5d2284c patch 8.2.5094: MS-Windows GUI: empty command may cause a dialog
Bram Moolenaar <Bram@vim.org>
parents: 29128
diff changeset
319 call add(v:errors, "Unexpected dialog: " .. readfile('guidialogfile')->join('<NL>'))
29128
d8a962d7b008 patch 8.2.5084: when the GUI shows a dialog tests get stuck
Bram Moolenaar <Bram@vim.org>
parents: 28148
diff changeset
320 call delete('guidialogfile')
d8a962d7b008 patch 8.2.5084: when the GUI shows a dialog tests get stuck
Bram Moolenaar <Bram@vim.org>
parents: 28148
diff changeset
321 endif
d8a962d7b008 patch 8.2.5084: when the GUI shows a dialog tests get stuck
Bram Moolenaar <Bram@vim.org>
parents: 28148
diff changeset
322
12688
a6a935b3270e patch 8.0.1222: test functions interfere with each other
Christian Brabandt <cb@256bit.org>
parents: 12682
diff changeset
323 " Close any extra tab pages and windows and make the current one not modified.
a6a935b3270e patch 8.0.1222: test functions interfere with each other
Christian Brabandt <cb@256bit.org>
parents: 12682
diff changeset
324 while tabpagenr('$') > 1
22470
f7471450243c patch 8.2.1783: try-catch test fails
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
325 let winid = win_getid()
12692
03a6aeea2096 patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents: 12688
diff changeset
326 quit!
22470
f7471450243c patch 8.2.1783: try-catch test fails
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
327 if winid == win_getid()
f7471450243c patch 8.2.1783: try-catch test fails
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
328 echoerr 'Could not quit window'
f7471450243c patch 8.2.1783: try-catch test fails
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
329 break
f7471450243c patch 8.2.1783: try-catch test fails
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
330 endif
12688
a6a935b3270e patch 8.0.1222: test functions interfere with each other
Christian Brabandt <cb@256bit.org>
parents: 12682
diff changeset
331 endwhile
a6a935b3270e patch 8.0.1222: test functions interfere with each other
Christian Brabandt <cb@256bit.org>
parents: 12682
diff changeset
332
9949
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9758
diff changeset
333 while 1
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9758
diff changeset
334 let wincount = winnr('$')
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9758
diff changeset
335 if wincount == 1
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9758
diff changeset
336 break
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9758
diff changeset
337 endif
9748
5440f3442841 commit https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5
Christian Brabandt <cb@256bit.org>
parents: 9632
diff changeset
338 bwipe!
9949
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9758
diff changeset
339 if wincount == winnr('$')
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9758
diff changeset
340 " Did not manage to close a window.
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9758
diff changeset
341 only!
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9758
diff changeset
342 break
30be4b26a37e commit https://github.com/vim/vim/commit/358308dd99abdd56c6540339e505585d8db7bdfe
Christian Brabandt <cb@256bit.org>
parents: 9758
diff changeset
343 endif
9748
5440f3442841 commit https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5
Christian Brabandt <cb@256bit.org>
parents: 9632
diff changeset
344 endwhile
12851
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12769
diff changeset
345
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents: 12769
diff changeset
346 exe 'cd ' . save_cwd
17032
84f308b126de patch 8.1.1516: time reported for a test measured wrong
Bram Moolenaar <Bram@vim.org>
parents: 16967
diff changeset
347
30357
2f295612c46a patch 9.0.0514: terminal test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
348 if a:test =~ '_terminal_'
2f295612c46a patch 9.0.0514: terminal test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
349 " Terminal tests sometimes hang, give extra information
2f295612c46a patch 9.0.0514: terminal test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
350 echoconsole 'Finished ' . a:test
2f295612c46a patch 9.0.0514: terminal test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
351 endif
2f295612c46a patch 9.0.0514: terminal test sometimes hangs
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
352
17032
84f308b126de patch 8.1.1516: time reported for a test measured wrong
Bram Moolenaar <Bram@vim.org>
parents: 16967
diff changeset
353 let message = 'Executed ' . a:test
84f308b126de patch 8.1.1516: time reported for a test measured wrong
Bram Moolenaar <Bram@vim.org>
parents: 16967
diff changeset
354 if has('reltime')
20963
ed35c81bce77 patch 8.2.1033: not easy to read the test time in the test output
Bram Moolenaar <Bram@vim.org>
parents: 20386
diff changeset
355 let message ..= repeat(' ', 50 - len(message))
30419
f652823ce8bb patch 9.0.0545: when a test is slow and CI times out there is no time info
Bram Moolenaar <Bram@vim.org>
parents: 30357
diff changeset
356 let time = reltime(g:func_start)
30310
029c59bf78f1 patch 9.0.0491: no good reason to build without the float feature
Bram Moolenaar <Bram@vim.org>
parents: 30180
diff changeset
357 if reltimefloat(time) > 0.1
21530
66f12838071d patch 8.2.1315: MS-Windows: test log contains escape sequences
Bram Moolenaar <Bram@vim.org>
parents: 21510
diff changeset
358 let message = s:t_bold .. message
20963
ed35c81bce77 patch 8.2.1033: not easy to read the test time in the test output
Bram Moolenaar <Bram@vim.org>
parents: 20386
diff changeset
359 endif
ed35c81bce77 patch 8.2.1033: not easy to read the test time in the test output
Bram Moolenaar <Bram@vim.org>
parents: 20386
diff changeset
360 let message ..= ' in ' .. reltimestr(time) .. ' seconds'
30310
029c59bf78f1 patch 9.0.0491: no good reason to build without the float feature
Bram Moolenaar <Bram@vim.org>
parents: 30180
diff changeset
361 if reltimefloat(time) > 0.1
21530
66f12838071d patch 8.2.1315: MS-Windows: test log contains escape sequences
Bram Moolenaar <Bram@vim.org>
parents: 21510
diff changeset
362 let message ..= s:t_normal
20963
ed35c81bce77 patch 8.2.1033: not easy to read the test time in the test output
Bram Moolenaar <Bram@vim.org>
parents: 20386
diff changeset
363 endif
17032
84f308b126de patch 8.1.1516: time reported for a test measured wrong
Bram Moolenaar <Bram@vim.org>
parents: 16967
diff changeset
364 endif
84f308b126de patch 8.1.1516: time reported for a test measured wrong
Bram Moolenaar <Bram@vim.org>
parents: 16967
diff changeset
365 call add(s:messages, message)
84f308b126de patch 8.1.1516: time reported for a test measured wrong
Bram Moolenaar <Bram@vim.org>
parents: 16967
diff changeset
366 let s:done += 1
31347
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
367
31402
1797406ac0bf patch 9.0.1034: reporting swap file when windows are split
Bram Moolenaar <Bram@vim.org>
parents: 31375
diff changeset
368 " close any split windows
1797406ac0bf patch 9.0.1034: reporting swap file when windows are split
Bram Moolenaar <Bram@vim.org>
parents: 31375
diff changeset
369 while winnr('$') > 1
1797406ac0bf patch 9.0.1034: reporting swap file when windows are split
Bram Moolenaar <Bram@vim.org>
parents: 31375
diff changeset
370 bwipe!
1797406ac0bf patch 9.0.1034: reporting swap file when windows are split
Bram Moolenaar <Bram@vim.org>
parents: 31375
diff changeset
371 endwhile
1797406ac0bf patch 9.0.1034: reporting swap file when windows are split
Bram Moolenaar <Bram@vim.org>
parents: 31375
diff changeset
372
31353
49bd0e97549d patch 9.0.1010: stray warnings for existing swap files
Bram Moolenaar <Bram@vim.org>
parents: 31347
diff changeset
373 " May be editing some buffer, wipe it out. Then we may end up in another
49bd0e97549d patch 9.0.1010: stray warnings for existing swap files
Bram Moolenaar <Bram@vim.org>
parents: 31347
diff changeset
374 " buffer, continue until we end up in an empty no-name buffer without a swap
49bd0e97549d patch 9.0.1010: stray warnings for existing swap files
Bram Moolenaar <Bram@vim.org>
parents: 31347
diff changeset
375 " file.
49bd0e97549d patch 9.0.1010: stray warnings for existing swap files
Bram Moolenaar <Bram@vim.org>
parents: 31347
diff changeset
376 while bufname() != '' || execute('swapname') !~ 'No swap file'
31357
7fe2e5f8be42 patch 9.0.1012: tests may get stuck in buffer with swap file
Bram Moolenaar <Bram@vim.org>
parents: 31353
diff changeset
377 let bn = bufnr()
7fe2e5f8be42 patch 9.0.1012: tests may get stuck in buffer with swap file
Bram Moolenaar <Bram@vim.org>
parents: 31353
diff changeset
378
7fe2e5f8be42 patch 9.0.1012: tests may get stuck in buffer with swap file
Bram Moolenaar <Bram@vim.org>
parents: 31353
diff changeset
379 noswapfile bwipe!
7fe2e5f8be42 patch 9.0.1012: tests may get stuck in buffer with swap file
Bram Moolenaar <Bram@vim.org>
parents: 31353
diff changeset
380
7fe2e5f8be42 patch 9.0.1012: tests may get stuck in buffer with swap file
Bram Moolenaar <Bram@vim.org>
parents: 31353
diff changeset
381 if bn == bufnr()
7fe2e5f8be42 patch 9.0.1012: tests may get stuck in buffer with swap file
Bram Moolenaar <Bram@vim.org>
parents: 31353
diff changeset
382 " avoid getting stuck in the same buffer
7fe2e5f8be42 patch 9.0.1012: tests may get stuck in buffer with swap file
Bram Moolenaar <Bram@vim.org>
parents: 31353
diff changeset
383 break
7fe2e5f8be42 patch 9.0.1012: tests may get stuck in buffer with swap file
Bram Moolenaar <Bram@vim.org>
parents: 31353
diff changeset
384 endif
31353
49bd0e97549d patch 9.0.1010: stray warnings for existing swap files
Bram Moolenaar <Bram@vim.org>
parents: 31347
diff changeset
385 endwhile
49bd0e97549d patch 9.0.1010: stray warnings for existing swap files
Bram Moolenaar <Bram@vim.org>
parents: 31347
diff changeset
386
31347
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
387 " Check if the test has left any swap files behind. Delete them before
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
388 " running tests again, they might interfere.
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
389 let swapfiles = s:GetSwapFileList()
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
390 if len(swapfiles) > 0
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
391 call add(s:messages, "Found swap files: " .. string(swapfiles))
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
392 for name in swapfiles
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
393 call delete(name)
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
394 endfor
56a2af8c0980 patch 9.0.1007: there is no way to get a list of swap file names
Bram Moolenaar <Bram@vim.org>
parents: 30451
diff changeset
395 endif
8370
cd7ea16d1300 commit https://github.com/vim/vim/commit/b5760a1ce5b700fc32b8bd11948ee189a847c59e
Christian Brabandt <cb@256bit.org>
parents: 8142
diff changeset
396 endfunc
7545
4c922651fd78 commit https://github.com/vim/vim/commit/28fb79db6b52d1154e8dc63d227673648c2fce15
Christian Brabandt <cb@256bit.org>
parents: 7540
diff changeset
397
19734
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
398 func AfterTheTest(func_name)
11181
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
399 if len(v:errors) > 0
19734
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
400 if match(s:may_fail_list, '^' .. a:func_name) >= 0
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
401 let s:fail_expected += 1
20003
e373843e2980 patch 8.2.0557: no IPv6 support for channels
Bram Moolenaar <Bram@vim.org>
parents: 19795
diff changeset
402 call add(s:errors_expected, 'Found errors in ' . g:testfunc . ':')
19734
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
403 call extend(s:errors_expected, v:errors)
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
404 else
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
405 let s:fail += 1
20003
e373843e2980 patch 8.2.0557: no IPv6 support for channels
Bram Moolenaar <Bram@vim.org>
parents: 19795
diff changeset
406 call add(s:errors, 'Found errors in ' . g:testfunc . ':')
19734
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
407 call extend(s:errors, v:errors)
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
408 endif
11181
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
409 let v:errors = []
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
410 endif
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
411 endfunc
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
412
14053
d6866c54a311 patch 8.1.0044: if a test function exists Vim this may go unnoticed
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
413 func EarlyExit(test)
d6866c54a311 patch 8.1.0044: if a test function exists Vim this may go unnoticed
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
414 " It's OK for the test we use to test the quit detection.
d6866c54a311 patch 8.1.0044: if a test function exists Vim this may go unnoticed
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
415 if a:test != 'Test_zz_quit_detected()'
26835
d9ced5bca6d6 patch 8.2.3946: when an internal error makes Vim exit the error is not seen
Bram Moolenaar <Bram@vim.org>
parents: 26500
diff changeset
416 call add(v:errors, v:errmsg)
14053
d6866c54a311 patch 8.1.0044: if a test function exists Vim this may go unnoticed
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
417 call add(v:errors, 'Test caused Vim to exit: ' . a:test)
d6866c54a311 patch 8.1.0044: if a test function exists Vim this may go unnoticed
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
418 endif
d6866c54a311 patch 8.1.0044: if a test function exists Vim this may go unnoticed
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
419
d6866c54a311 patch 8.1.0044: if a test function exists Vim this may go unnoticed
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
420 call FinishTesting()
d6866c54a311 patch 8.1.0044: if a test function exists Vim this may go unnoticed
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
421 endfunc
d6866c54a311 patch 8.1.0044: if a test function exists Vim this may go unnoticed
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
422
11181
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
423 " This function can be called by a test if it wants to abort testing.
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
424 func FinishTesting()
19734
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
425 call AfterTheTest('')
11181
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
426
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
427 " Don't write viminfo on exit.
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
428 set viminfo=
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
429
11850
eb339f9af281 patch 8.0.0805: GUI test fails with gnome2
Christian Brabandt <cb@256bit.org>
parents: 11205
diff changeset
430 " Clean up files created by setup.vim
eb339f9af281 patch 8.0.0805: GUI test fails with gnome2
Christian Brabandt <cb@256bit.org>
parents: 11205
diff changeset
431 call delete('XfakeHOME', 'rf')
eb339f9af281 patch 8.0.0805: GUI test fails with gnome2
Christian Brabandt <cb@256bit.org>
parents: 11205
diff changeset
432
19734
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
433 if s:fail == 0 && s:fail_expected == 0
11181
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
434 " Success, create the .res file so that make knows it's done.
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
435 exe 'split ' . fnamemodify(g:testname, ':r') . '.res'
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
436 write
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
437 endif
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
438
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
439 if len(s:errors) > 0
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
440 " Append errors to test.log
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
441 split test.log
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
442 call append(line('$'), '')
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
443 call append(line('$'), 'From ' . g:testname . ':')
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
444 call append(line('$'), s:errors)
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
445 write
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
446 endif
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
447
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents: 13533
diff changeset
448 if s:done == 0
18189
b5bf891fa92c patch 8.1.2089: do not get a hint that $TEST_FILTER was active
Bram Moolenaar <Bram@vim.org>
parents: 18184
diff changeset
449 if s:filtered > 0
25549
dc25589bfec0 patch 8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Bram Moolenaar <Bram@vim.org>
parents: 24194
diff changeset
450 if $TEST_FILTER != ''
dc25589bfec0 patch 8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Bram Moolenaar <Bram@vim.org>
parents: 24194
diff changeset
451 let message = "NO tests match $TEST_FILTER: '" .. $TEST_FILTER .. "'"
dc25589bfec0 patch 8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Bram Moolenaar <Bram@vim.org>
parents: 24194
diff changeset
452 else
dc25589bfec0 patch 8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Bram Moolenaar <Bram@vim.org>
parents: 24194
diff changeset
453 let message = "ALL tests match $TEST_SKIP_PAT: '" .. $TEST_SKIP_PAT .. "'"
dc25589bfec0 patch 8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Bram Moolenaar <Bram@vim.org>
parents: 24194
diff changeset
454 endif
18189
b5bf891fa92c patch 8.1.2089: do not get a hint that $TEST_FILTER was active
Bram Moolenaar <Bram@vim.org>
parents: 18184
diff changeset
455 else
b5bf891fa92c patch 8.1.2089: do not get a hint that $TEST_FILTER was active
Bram Moolenaar <Bram@vim.org>
parents: 18184
diff changeset
456 let message = 'NO tests executed'
b5bf891fa92c patch 8.1.2089: do not get a hint that $TEST_FILTER was active
Bram Moolenaar <Bram@vim.org>
parents: 18184
diff changeset
457 endif
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents: 13533
diff changeset
458 else
18189
b5bf891fa92c patch 8.1.2089: do not get a hint that $TEST_FILTER was active
Bram Moolenaar <Bram@vim.org>
parents: 18184
diff changeset
459 if s:filtered > 0
25549
dc25589bfec0 patch 8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Bram Moolenaar <Bram@vim.org>
parents: 24194
diff changeset
460 call add(s:messages, "Filtered " .. s:filtered .. " tests with $TEST_FILTER and $TEST_SKIP_PAT")
18189
b5bf891fa92c patch 8.1.2089: do not get a hint that $TEST_FILTER was active
Bram Moolenaar <Bram@vim.org>
parents: 18184
diff changeset
461 endif
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents: 13533
diff changeset
462 let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test')
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents: 13533
diff changeset
463 endif
18189
b5bf891fa92c patch 8.1.2089: do not get a hint that $TEST_FILTER was active
Bram Moolenaar <Bram@vim.org>
parents: 18184
diff changeset
464 if s:done > 0 && has('reltime')
21530
66f12838071d patch 8.2.1315: MS-Windows: test log contains escape sequences
Bram Moolenaar <Bram@vim.org>
parents: 21510
diff changeset
465 let message = s:t_bold .. message .. repeat(' ', 40 - len(message))
30449
55aa44dd59ef patch 9.0.0560: elapsed time since testing started is not visible
Bram Moolenaar <Bram@vim.org>
parents: 30419
diff changeset
466 let message ..= ' in ' .. reltimestr(reltime(s:run_start_time)) .. ' seconds'
21530
66f12838071d patch 8.2.1315: MS-Windows: test log contains escape sequences
Bram Moolenaar <Bram@vim.org>
parents: 21510
diff changeset
467 let message ..= s:t_normal
16967
586d625e21b4 patch 8.1.1484: some tests are slow
Bram Moolenaar <Bram@vim.org>
parents: 16951
diff changeset
468 endif
11181
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
469 echo message
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
470 call add(s:messages, message)
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
471 if s:fail > 0
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
472 let message = s:fail . ' FAILED:'
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
473 echo message
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
474 call add(s:messages, message)
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
475 call extend(s:messages, s:errors)
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
476 endif
19734
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
477 if s:fail_expected > 0
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
478 let message = s:fail_expected . ' FAILED (matching $TEST_MAY_FAIL):'
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
479 echo message
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
480 call add(s:messages, message)
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
481 call extend(s:messages, s:errors_expected)
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
482 endif
11181
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
483
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
484 " Add SKIPPED messages
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
485 call extend(s:messages, s:skipped)
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
486
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
487 " Append messages to the file "messages"
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
488 split messages
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
489 call append(line('$'), '')
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
490 call append(line('$'), 'From ' . g:testname . ':')
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
491 call append(line('$'), s:messages)
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
492 write
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
493
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
494 qall!
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
495 endfunc
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
496
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
497 " 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
498 " 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
499 let g:testname = expand('%')
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
500 let s:done = 0
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
501 let s:fail = 0
19734
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
502 let s:fail_expected = 0
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
503 let s:errors = []
19734
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
504 let s:errors_expected = []
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
505 let s:messages = []
10100
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9949
diff changeset
506 let s:skipped = []
10942
e05695e59f6d patch 8.0.0360: sometimes VimL is used instead of "Vim script"
Christian Brabandt <cb@256bit.org>
parents: 10811
diff changeset
507 if expand('%') =~ 'test_vimscript.vim'
19734
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
508 " 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
509 source %
7454
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
510 else
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
511 try
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
512 source %
16951
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
513 catch /^\cskipped/
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
514 call add(s:messages, ' Skipped')
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
515 call add(s:skipped, 'SKIPPED ' . expand('%') . ': ' . substitute(v:exception, '^\S*\s\+', '', ''))
7454
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
516 catch
8029
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
517 let s:fail += 1
770dd91ad9f7 commit https://github.com/vim/vim/commit/00af60bbb6cc7e8ccafddb30a1964f891b800bce
Christian Brabandt <cb@256bit.org>
parents: 7637
diff changeset
518 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
519 endtry
4ff843da79fd commit https://github.com/vim/vim/commit/a2cce8630756769b2cefdc28c7290ae9262cddb1
Christian Brabandt <cb@256bit.org>
parents: 7391
diff changeset
520 endif
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
521
28148
fecc185fcf69 patch 8.2.4598: profile completion test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26835
diff changeset
522 " Delete the .res file, it may change behavior for completion
fecc185fcf69 patch 8.2.4598: profile completion test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26835
diff changeset
523 call delete(fnamemodify(g:testname, ':r') .. '.res')
fecc185fcf69 patch 8.2.4598: profile completion test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 26835
diff changeset
524
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
525 " Locate Test_ functions and execute them.
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
526 redir @q
8116
3c1bdf20c8b9 commit https://github.com/vim/vim/commit/93bf558caef2d507ef6baf56eaf6025b63da1e34
Christian Brabandt <cb@256bit.org>
parents: 8029
diff changeset
527 silent function /^Test_
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
528 redir END
19579
aae19dd172c0 patch 8.2.0346: Vim9: finding common list type not tested
Bram Moolenaar <Bram@vim.org>
parents: 18763
diff changeset
529 let s:tests = split(substitute(@q, '\(function\|def\) \(\k*()\)', '\2', 'g'))
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
530
8142
71aabce3142e commit https://github.com/vim/vim/commit/befb366affa6309c6b4a469ec7f729821e3a36fa
Christian Brabandt <cb@256bit.org>
parents: 8116
diff changeset
531 " If there is an extra argument filter the function names against it.
71aabce3142e commit https://github.com/vim/vim/commit/befb366affa6309c6b4a469ec7f729821e3a36fa
Christian Brabandt <cb@256bit.org>
parents: 8116
diff changeset
532 if argc() > 1
71aabce3142e commit https://github.com/vim/vim/commit/befb366affa6309c6b4a469ec7f729821e3a36fa
Christian Brabandt <cb@256bit.org>
parents: 8116
diff changeset
533 let s:tests = filter(s:tests, 'v:val =~ argv(1)')
71aabce3142e commit https://github.com/vim/vim/commit/befb366affa6309c6b4a469ec7f729821e3a36fa
Christian Brabandt <cb@256bit.org>
parents: 8116
diff changeset
534 endif
71aabce3142e commit https://github.com/vim/vim/commit/befb366affa6309c6b4a469ec7f729821e3a36fa
Christian Brabandt <cb@256bit.org>
parents: 8116
diff changeset
535
18184
ef35a3a70c24 patch 8.1.2087: cannot easily select one test function to execute
Bram Moolenaar <Bram@vim.org>
parents: 18158
diff changeset
536 " If the environment variable $TEST_FILTER is set then filter the function
ef35a3a70c24 patch 8.1.2087: cannot easily select one test function to execute
Bram Moolenaar <Bram@vim.org>
parents: 18158
diff changeset
537 " names against it.
18189
b5bf891fa92c patch 8.1.2089: do not get a hint that $TEST_FILTER was active
Bram Moolenaar <Bram@vim.org>
parents: 18184
diff changeset
538 let s:filtered = 0
18184
ef35a3a70c24 patch 8.1.2087: cannot easily select one test function to execute
Bram Moolenaar <Bram@vim.org>
parents: 18158
diff changeset
539 if $TEST_FILTER != ''
18189
b5bf891fa92c patch 8.1.2089: do not get a hint that $TEST_FILTER was active
Bram Moolenaar <Bram@vim.org>
parents: 18184
diff changeset
540 let s:filtered = len(s:tests)
18184
ef35a3a70c24 patch 8.1.2087: cannot easily select one test function to execute
Bram Moolenaar <Bram@vim.org>
parents: 18158
diff changeset
541 let s:tests = filter(s:tests, 'v:val =~ $TEST_FILTER')
18189
b5bf891fa92c patch 8.1.2089: do not get a hint that $TEST_FILTER was active
Bram Moolenaar <Bram@vim.org>
parents: 18184
diff changeset
542 let s:filtered -= len(s:tests)
18184
ef35a3a70c24 patch 8.1.2087: cannot easily select one test function to execute
Bram Moolenaar <Bram@vim.org>
parents: 18158
diff changeset
543 endif
ef35a3a70c24 patch 8.1.2087: cannot easily select one test function to execute
Bram Moolenaar <Bram@vim.org>
parents: 18158
diff changeset
544
19734
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
545 let s:may_fail_list = []
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
546 if $TEST_MAY_FAIL != ''
20003
e373843e2980 patch 8.2.0557: no IPv6 support for channels
Bram Moolenaar <Bram@vim.org>
parents: 19795
diff changeset
547 " Split the list at commas and add () to make it match g:testfunc.
19734
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
548 let s:may_fail_list = split($TEST_MAY_FAIL, ',')->map({i, v -> v .. '()'})
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
549 endif
2bd03926397a patch 8.2.0423: in some environments a few tests are expected to fail
Bram Moolenaar <Bram@vim.org>
parents: 19715
diff changeset
550
7540
b910bb01832a commit https://github.com/vim/vim/commit/cfc0a350a9fa04f1b0cfa1ba31fbd2847376513f
Christian Brabandt <cb@256bit.org>
parents: 7454
diff changeset
551 " Execute the tests in alphabetical order.
20003
e373843e2980 patch 8.2.0557: no IPv6 support for channels
Bram Moolenaar <Bram@vim.org>
parents: 19795
diff changeset
552 for g:testfunc in sort(s:tests)
25549
dc25589bfec0 patch 8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Bram Moolenaar <Bram@vim.org>
parents: 24194
diff changeset
553 if $TEST_SKIP_PAT != '' && g:testfunc =~ $TEST_SKIP_PAT
dc25589bfec0 patch 8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Bram Moolenaar <Bram@vim.org>
parents: 24194
diff changeset
554 call add(s:messages, g:testfunc .. ' matches $TEST_SKIP_PAT')
dc25589bfec0 patch 8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Bram Moolenaar <Bram@vim.org>
parents: 24194
diff changeset
555 let s:filtered += 1
dc25589bfec0 patch 8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Bram Moolenaar <Bram@vim.org>
parents: 24194
diff changeset
556 continue
dc25589bfec0 patch 8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Bram Moolenaar <Bram@vim.org>
parents: 24194
diff changeset
557 endif
dc25589bfec0 patch 8.2.3311: Vim9: check for DO_NOT_FREE_CNT is very slow
Bram Moolenaar <Bram@vim.org>
parents: 24194
diff changeset
558
12616
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents: 12381
diff changeset
559 " Silence, please!
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents: 12381
diff changeset
560 set belloff=all
15036
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
561 let prev_error = ''
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
562 let total_errors = []
19795
1c7f92a1100e patch 8.2.0454: some tests fail when the system is slow
Bram Moolenaar <Bram@vim.org>
parents: 19734
diff changeset
563 let g:run_nr = 1
12616
4767939d10cc patch 8.0.1186: still quite a few old style tests
Christian Brabandt <cb@256bit.org>
parents: 12381
diff changeset
564
20003
e373843e2980 patch 8.2.0557: no IPv6 support for channels
Bram Moolenaar <Bram@vim.org>
parents: 19795
diff changeset
565 " A test can set g:test_is_flaky to retry running the test.
e373843e2980 patch 8.2.0557: no IPv6 support for channels
Bram Moolenaar <Bram@vim.org>
parents: 19795
diff changeset
566 let g:test_is_flaky = 0
19687
c3f506e24eab patch 8.2.0400: not all tests using a terminal are in the list of flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 19579
diff changeset
567
30069
cb21745cbbab patch 9.0.0372: MS-Windows: "%T" time format does not appear to work
Bram Moolenaar <Bram@vim.org>
parents: 30063
diff changeset
568 let starttime = strftime("%H:%M:%S")
20003
e373843e2980 patch 8.2.0557: no IPv6 support for channels
Bram Moolenaar <Bram@vim.org>
parents: 19795
diff changeset
569 call RunTheTest(g:testfunc)
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
570
15036
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
571 " Repeat a flaky test. Give up when:
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 21433
diff changeset
572 " - $TEST_NO_RETRY is not empty
15036
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
573 " - it fails again with the same message
17918
9606c0adc148 patch 8.1.1955: tests contain typos
Bram Moolenaar <Bram@vim.org>
parents: 17910
diff changeset
574 " - it fails five times (with a different message)
15040
da8a8cdcb8b0 patch 8.1.0531: flaky tests often fail with a common error message
Bram Moolenaar <Bram@vim.org>
parents: 15038
diff changeset
575 if len(v:errors) > 0
21510
31cb78014fe4 patch 8.2.1305: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
576 \ && $TEST_NO_RETRY == ''
25969
a5a772dace5b patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 25549
diff changeset
577 \ && g:test_is_flaky
15036
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
578 while 1
30063
72c8fbb9e242 patch 9.0.0369: a failing flaky test doesn't mention the time
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
579 call add(s:messages, 'Found errors in ' .. g:testfunc .. ':')
15036
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
580 call extend(s:messages, v:errors)
11187
515db00c4676 patch 8.0.0480: the remote_peek() test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11185
diff changeset
581
30180
b01eaf122e5a patch 9.0.0426: failed flaky tests reports only start time
Bram Moolenaar <Bram@vim.org>
parents: 30069
diff changeset
582 let endtime = strftime("%H:%M:%S")
b01eaf122e5a patch 9.0.0426: failed flaky tests reports only start time
Bram Moolenaar <Bram@vim.org>
parents: 30069
diff changeset
583 call add(total_errors, $'Run {g:run_nr}, {starttime} - {endtime}:')
15036
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
584 call extend(total_errors, v:errors)
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
585
29387
9dce192d1ac2 patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents: 29340
diff changeset
586 if g:run_nr >= 5 || prev_error == v:errors[0]
15036
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
587 call add(total_errors, 'Flaky test failed too often, giving up')
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
588 let v:errors = total_errors
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
589 break
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
590 endif
12905
30b0d784c870 patch 8.0.1329: when a flaky test fails it also often fails the second time
Christian Brabandt <cb@256bit.org>
parents: 12851
diff changeset
591
15036
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
592 call add(s:messages, 'Flaky test failed, running it again')
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
593
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
594 " Flakiness is often caused by the system being very busy. Sleep a
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
595 " couple of seconds to have a higher chance of succeeding the second
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
596 " time.
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
597 sleep 2
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
598
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
599 let prev_error = v:errors[0]
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
600 let v:errors = []
19795
1c7f92a1100e patch 8.2.0454: some tests fail when the system is slow
Bram Moolenaar <Bram@vim.org>
parents: 19734
diff changeset
601 let g:run_nr += 1
15036
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
602
30069
cb21745cbbab patch 9.0.0372: MS-Windows: "%T" time format does not appear to work
Bram Moolenaar <Bram@vim.org>
parents: 30063
diff changeset
603 let starttime = strftime("%H:%M:%S")
20003
e373843e2980 patch 8.2.0557: no IPv6 support for channels
Bram Moolenaar <Bram@vim.org>
parents: 19795
diff changeset
604 call RunTheTest(g:testfunc)
15036
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
605
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
606 if len(v:errors) == 0
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
607 " Test passed on rerun.
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
608 break
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
609 endif
73fef88aa0f9 patch 8.1.0529: flaky test sometimes fails in different ways
Bram Moolenaar <Bram@vim.org>
parents: 15018
diff changeset
610 endwhile
8370
cd7ea16d1300 commit https://github.com/vim/vim/commit/b5760a1ce5b700fc32b8bd11948ee189a847c59e
Christian Brabandt <cb@256bit.org>
parents: 8142
diff changeset
611 endif
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
612
20003
e373843e2980 patch 8.2.0557: no IPv6 support for channels
Bram Moolenaar <Bram@vim.org>
parents: 19795
diff changeset
613 call AfterTheTest(g:testfunc)
7277
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
614 endfor
6600871bb38c commit https://github.com/vim/vim/commit/43345546ae63710441f066648b8485fb545b3801
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
615
11181
13544aa85dc0 patch 8.0.0477: the client-server test may hang when failing
Christian Brabandt <cb@256bit.org>
parents: 11169
diff changeset
616 call FinishTesting()
10388
6cdb0226d74a commit https://github.com/vim/vim/commit/cc28e2d05d05552d8b72a520be8a193f3d9822d4
Christian Brabandt <cb@256bit.org>
parents: 10229
diff changeset
617
6cdb0226d74a commit https://github.com/vim/vim/commit/cc28e2d05d05552d8b72a520be8a193f3d9822d4
Christian Brabandt <cb@256bit.org>
parents: 10229
diff changeset
618 " vim: shiftwidth=2 sts=2 expandtab