patch 9.1.1399: tests: test_codestyle fails for auto-generated files
Problem: tests: test_codestyle fails for auto-generated files.
While those files are already ignored in Test_source_Files(),
the newly added Test_indent_of_source_files() does not filter
those out and causes test failures on appveyor.
Solution: factor out the generation of all c files into a common function
and filter out auto-generated files if_ole.h, iid_ole.c and
dlldata.c
closes: #17352
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
" Test for checking the source code style.
|
||||
|
||||
let s:list_of_c_files = []
|
||||
|
||||
def s:ReportError(fname: string, lnum: number, msg: string)
|
||||
if lnum > 0
|
||||
assert_report(fname .. ' line ' .. lnum .. ': ' .. msg)
|
||||
@ -22,19 +24,21 @@ def s:PerformCheck(fname: string, pattern: string, msg: string, skip: string)
|
||||
endwhile
|
||||
enddef
|
||||
|
||||
def s:Get_C_source_files(): list<string>
|
||||
if empty(list_of_c_files)
|
||||
var list = glob('../*.[ch]', 0, 1) + ['../xxd/xxd.c']
|
||||
# Some files are auto-generated and may contain space errors, so skip those
|
||||
list_of_c_files = filter(list, (i, v) => v !~ 'dlldata.c\|if_ole.h\|iid_ole.c')
|
||||
endif
|
||||
return list_of_c_files
|
||||
enddef
|
||||
|
||||
def Test_source_files()
|
||||
for fname in glob('../*.[ch]', 0, 1) + ['../xxd/xxd.c']
|
||||
for fname in Get_C_source_files()
|
||||
bwipe!
|
||||
g:ignoreSwapExists = 'e'
|
||||
exe 'edit ' .. fname
|
||||
|
||||
# Some files are generated files and may contain space errors.
|
||||
if fname =~ 'dlldata.c'
|
||||
|| fname =~ 'if_ole.h'
|
||||
|| fname =~ 'iid_ole.c'
|
||||
continue
|
||||
endif
|
||||
|
||||
PerformCheck(fname, ' \t', 'space before Tab', '')
|
||||
|
||||
PerformCheck(fname, '\s$', 'trailing white space', '')
|
||||
@ -164,7 +168,7 @@ def Test_help_files()
|
||||
enddef
|
||||
|
||||
def Test_indent_of_source_files()
|
||||
for fname in glob('../*.[ch]', 0, 1) + ['../xxd/xxd.c']
|
||||
for fname in Get_C_source_files()
|
||||
execute 'tabnew ' .. fname
|
||||
if &expandtab
|
||||
continue
|
||||
|
||||
@ -709,6 +709,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1399,
|
||||
/**/
|
||||
1398,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user