Skip to content

Commit b0905e2

Browse files
committed
patch 9.1.1524: tests: too many imports in the test suite
Problem: tests: too many imports in the test suite Solution: Clean up the imported scripts Most tests make use of check.vim, so let's just source it once in runtest.vim instead of having each test manually source it. runtest.vim already sources shared.vim, which again sources view_util.vim, so we don't need to source those two common dependencies in all the other tests And then check.vim sources term_util.vim already, so we can in addition drop sourcing it explicitly in each single test script. Note: test_expand_func.vim had to be updated to account for the changed number of sourced files. And finally check.vim uses line-continuation so let's also explicitly enable line continuation via the 'cpo' option value. related: #17677 Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent a4874d4 commit b0905e2

File tree

219 files changed

+19
-450
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

219 files changed

+19
-450
lines changed

src/testdir/check.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
source shared.vim
22
source term_util.vim
33

4+
" uses line-continuation
5+
let s:cpo_save = &cpo
6+
set cpo&vim
7+
48
command -nargs=1 MissingFeature throw 'Skipped: ' .. <args> .. ' feature missing'
59

610
" Command to check for the presence of a feature.
@@ -324,4 +328,7 @@ func CheckGithubActions()
324328
throw "Skipped: FIXME: this test doesn't work on Github Actions CI"
325329
endif
326330
endfunc
331+
332+
let &cpo = s:cpo_save
333+
unlet s:cpo_save
327334
" vim: shiftwidth=2 sts=2 expandtab

src/testdir/runtest.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ source setup.vim
106106
" Needed for RunningWithValgrind().
107107
source shared.vim
108108

109+
" Needed for the various Check commands
110+
source check.vim
111+
109112
" For consistency run all tests with 'nocompatible' set.
110113
" This also enables use of line continuation.
111114
set nocp viminfo+=nviminfo

src/testdir/screendump.vim

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ if exists('*VerifyScreenDump')
55
finish
66
endif
77

8-
source shared.vim
9-
source term_util.vim
10-
118
" Skip the rest if there is no terminal feature at all.
129
if !has('terminal')
1310
finish

src/testdir/test_arabic.vim

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
" NOTE: This just checks if the code works. If you know Arabic please add
33
" functional tests that check the shaping works with real text.
44

5-
source check.vim
65
CheckFeature arabic
76

8-
source view_util.vim
9-
107
" Return list of Unicode characters at line lnum.
118
" Combining characters are treated as a single item.
129
func s:get_chars(lnum)

src/testdir/test_arglist.vim

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
" Test argument list commands
22

3-
source check.vim
4-
source shared.vim
5-
source term_util.vim
6-
73
func Reset_arglist()
84
args a | %argd
95
endfunc

src/testdir/test_assert.vim

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
" Test that the methods used for testing work.
22

3-
source check.vim
4-
source term_util.vim
5-
63
func Test_assert_false()
74
call assert_equal(0, assert_false(0))
85
call assert_equal(0, assert_false(v:false))

src/testdir/test_autochdir.vim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
" Test 'autochdir' behavior
22

3-
source check.vim
43
CheckOption autochdir
54

65
func Test_set_filename()

src/testdir/test_autocmd.vim

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
" Tests for autocommands
22

3-
source shared.vim
4-
source check.vim
5-
source term_util.vim
63
source screendump.vim
74
import './vim9.vim' as v9
85

src/testdir/test_backup.vim

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
" Tests for the backup function
22

3-
source check.vim
4-
53
func Test_backup()
64
set backup backupdir=. backupskip=
75
new

src/testdir/test_balloon.vim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
" Tests for 'balloonevalterm'.
22
" A few tests only work in the terminal.
33

4-
source check.vim
54
CheckNotGui
65
CheckFeature balloon_eval_term
76

0 commit comments

Comments
 (0)