patch 9.1.1399: tests: test_codestyle fails for auto-generated files

Commit: 
https://github.com/vim/vim/commit/681f1c914f8b4a1b53b838d5d6d8d0b931ea1ee0
Author: Christian Brabandt <c...@256bit.org>
Date:   Wed May 21 20:50:11 2025 +0200

    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 <c...@256bit.org>

diff --git a/src/testdir/test_codestyle.vim b/src/testdir/test_codestyle.vim
index b7bbad3f9..ea12b6c66 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<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, '      ', '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 a63fc0929..570bfe494 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,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1uHofg-007Bjj-0d%40256bit.org.

Raspunde prin e-mail lui