mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.1257: code style is not check in test scripts
Problem: Code style is not check in test scripts.
Solution: Add basic code style check for test files.
94722c5107
Use Test_test_files() from latest Vim.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
f17d819330
commit
457ab65ff3
@ -48,6 +48,16 @@
|
||||
" call add(v:errors, "this happened")
|
||||
|
||||
|
||||
" Without the +eval feature we can't run these tests, bail out.
|
||||
silent! while 0
|
||||
qa!
|
||||
silent! endwhile
|
||||
|
||||
" In the GUI we can always change the screen size.
|
||||
if has('gui_running')
|
||||
set columns=80 lines=25
|
||||
endif
|
||||
|
||||
" Check that the screen size is at least 24 x 80 characters.
|
||||
if &lines < 24 || &columns < 80
|
||||
let error = 'Screen size too small! Tests require at least 24 lines with 80 characters, got ' .. &lines .. ' lines with ' .. &columns .. ' characters'
|
||||
|
@ -6,6 +6,45 @@ func s:ReportError(fname, lnum, msg)
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func Test_test_files()
|
||||
for fname in glob('*.vim', 0, 1)
|
||||
let g:ignoreSwapExists = 'e'
|
||||
exe 'edit ' .. fname
|
||||
|
||||
" some files intentionally have misplaced white space
|
||||
if fname =~ 'test_cindent.vim' || fname =~ 'test_join.vim'
|
||||
continue
|
||||
endif
|
||||
|
||||
" skip files that are known to have a space before a tab
|
||||
if fname !~ 'test_comments.vim'
|
||||
\ && fname !~ 'test_listchars.vim'
|
||||
\ && fname !~ 'test_visual.vim'
|
||||
call cursor(1, 1)
|
||||
let skip = 'getline(".") =~ "codestyle: ignore"'
|
||||
let lnum = search(fname =~ "test_regexp_latin" ? '[^á] \t' : ' \t', 'W', 0, 0, skip)
|
||||
call s:ReportError('testdir/' .. fname, lnum, 'space before Tab')
|
||||
endif
|
||||
|
||||
" skip files that are known to have trailing white space
|
||||
if fname !~ 'test_cmdline.vim'
|
||||
\ && fname !~ 'test_let.vim'
|
||||
\ && fname !~ 'test_tagjump.vim'
|
||||
\ && fname !~ 'test_vim9_cmd.vim'
|
||||
call cursor(1, 1)
|
||||
let lnum = search(
|
||||
\ fname =~ 'test_vim9_assign.vim' ? '[^=]\s$'
|
||||
\ : fname =~ 'test_vim9_class.vim' ? '[^)]\s$'
|
||||
\ : fname =~ 'test_vim9_script.vim' ? '[^,:3]\s$'
|
||||
\ : fname =~ 'test_visual.vim' ? '[^/]\s$'
|
||||
\ : '[^\\]\s$')
|
||||
call s:ReportError('testdir/' .. fname, lnum, 'trailing white space')
|
||||
endif
|
||||
endfor
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_help_files()
|
||||
set nowrapscan
|
||||
|
||||
|
@ -1020,11 +1020,9 @@ endfunc
|
||||
|
||||
" More tests for 'errorformat'
|
||||
func Test_efm1()
|
||||
if !has('unix')
|
||||
" The 'errorformat' setting is different on non-Unix systems.
|
||||
" This test works only on Unix-like systems.
|
||||
return
|
||||
endif
|
||||
CheckUnix
|
||||
|
||||
let l =<< trim [DATA]
|
||||
"Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set.
|
||||
|
@ -89,7 +89,7 @@ func Test_tagfunc()
|
||||
return v:null
|
||||
endfunc
|
||||
set tags= tfu=NullTagFunc
|
||||
call assert_fails('tag nothing', 'E433')
|
||||
call assert_fails('tag nothing', 'E433:')
|
||||
delf NullTagFunc
|
||||
|
||||
bwipe!
|
||||
|
@ -348,8 +348,15 @@ endfunc
|
||||
" Test that the garbage collector isn't triggered if a timer callback invokes
|
||||
" vgetc().
|
||||
func Test_nocatch_timer_garbage_collect()
|
||||
" skipped: Nvim does not support test_garbagecollect_soon(), test_override()
|
||||
" FIXME: why does this fail only on MacOS M1?
|
||||
try
|
||||
CheckNotMacM1
|
||||
throw 'Skipped: Nvim does not support test_garbagecollect_soon(), test_override()'
|
||||
catch /Skipped/
|
||||
let g:skipped_reason = v:exception
|
||||
return
|
||||
endtry
|
||||
|
||||
" 'uptimetime. must be bigger than the timer timeout
|
||||
set ut=200
|
||||
call test_garbagecollect_soon()
|
||||
|
@ -117,7 +117,6 @@ func Test_true_false_arg()
|
||||
endfunc
|
||||
|
||||
function Try_arg_non_zero(expr, false_val, true_val)
|
||||
CheckFeature float
|
||||
for v in ['v:false', '0', '[1]', '{2:3}', '3.4']
|
||||
let r = eval(substitute(a:expr, '%v%', v, ''))
|
||||
call assert_equal(a:false_val, r, 'result for ' . v . ' is not ' . a:false_val . ' but ' . r)
|
||||
|
Loading…
Reference in New Issue
Block a user