From 681f1c914f8b4a1b53b838d5d6d8d0b931ea1ee0 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Wed, 21 May 2025 20:50:11 +0200 Subject: [PATCH] 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 --- src/testdir/test_codestyle.vim | 22 +++++++++++++--------- src/version.c | 2 ++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/testdir/test_codestyle.vim b/src/testdir/test_codestyle.vim index b7bbad3f9e..ea12b6c66d 100644 --- a/src/testdir/test_codestyle.vim +++ b/src/testdir/test_codestyle.vim @@ -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 + 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 diff --git a/src/version.c b/src/version.c index a63fc09297..570bfe4946 100644 --- a/src/version.c +++ b/src/version.c @@ -709,6 +709,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1399, /**/ 1398, /**/ -- 2.47.2