mirror of
https://github.com/vim/vim.git
synced 2025-10-28 09:27:14 -04:00
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>
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
" Tests for expand()
|
||||
|
||||
source shared.vim
|
||||
|
||||
let s:sfile = expand('<sfile>')
|
||||
let s:slnum = str2nr(expand('<slnum>'))
|
||||
let s:sflnum = str2nr(expand('<sflnum>'))
|
||||
@@ -20,20 +18,20 @@ endfunc
|
||||
|
||||
" This test depends on the location in the test file, put it first.
|
||||
func Test_expand_sflnum()
|
||||
call assert_equal(7, s:sflnum)
|
||||
call assert_equal(24, str2nr(expand('<sflnum>')))
|
||||
call assert_equal(5, s:sflnum)
|
||||
call assert_equal(22, str2nr(expand('<sflnum>')))
|
||||
|
||||
" Line-continuation
|
||||
call assert_equal(
|
||||
\ 27,
|
||||
\ 25,
|
||||
\ str2nr(expand('<sflnum>')))
|
||||
|
||||
" Call in script-local function
|
||||
call assert_equal(18, s:expand_sflnum())
|
||||
call assert_equal(16, s:expand_sflnum())
|
||||
|
||||
" Call in command
|
||||
command Flnum echo expand('<sflnum>')
|
||||
call assert_equal(36, str2nr(trim(execute('Flnum'))))
|
||||
call assert_equal(34, str2nr(trim(execute('Flnum'))))
|
||||
delcommand Flnum
|
||||
endfunc
|
||||
|
||||
@@ -86,7 +84,7 @@ func Test_expand_sfile_and_stack()
|
||||
endfunc
|
||||
|
||||
func Test_expand_slnum()
|
||||
call assert_equal(6, s:slnum)
|
||||
call assert_equal(4, s:slnum)
|
||||
call assert_equal(2, str2nr(expand('<slnum>')))
|
||||
|
||||
" Line-continuation
|
||||
|
||||
Reference in New Issue
Block a user