]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1399: tests: test_codestyle fails for auto-generated files v9.1.1399
authorChristian Brabandt <cb@256bit.org>
Wed, 21 May 2025 18:50:11 +0000 (20:50 +0200)
committerChristian Brabandt <cb@256bit.org>
Wed, 21 May 2025 18:50:11 +0000 (20:50 +0200)
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>
src/testdir/test_codestyle.vim
src/version.c

index b7bbad3f9e7914df33773328bade990874f673f1..ea12b6c66dbd702af06aa42a47849a017813d9c6 100644 (file)
@@ -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
index a63fc09297de4c79ea99dec3a31f0c8ff51c424e..570bfe49467c878d4ca59974a724c28661f3489d 100644 (file)
@@ -709,6 +709,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1399,
 /**/
     1398,
 /**/