patch 9.1.0570: tests: test_gettext_make can be improved

Commit: 
https://github.com/vim/vim/commit/8a7563bbea331949117f605ec6076ac1bc9112ee
Author: Ken Takata <ken...@csc.jp>
Date:   Fri Jul 12 07:35:36 2024 +0200

    patch 9.1.0570: tests: test_gettext_make can be improved
    
    Problem:  tests: test_gettext_make can be improved
              (after v9.1.0559)
    Solution: Improve the test
              (Ken Takata)
    
    * Remove unnecessary comment.
    * Check the gettext feature.
    * Check whether %GETTEXT_PATH% is set.
    * Check the return code of the make command.
    * Use heredoc.
    
    closes: #15221
    
    Signed-off-by: Ken Takata <ken...@csc.jp>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/testdir/test_gettext_make.vim 
b/src/testdir/test_gettext_make.vim
index 480e2ee24..22b04745e 100644
--- a/src/testdir/test_gettext_make.vim
+++ b/src/testdir/test_gettext_make.vim
@@ -1,11 +1,14 @@
 source check.vim
-"CheckNotMSWindows
 CheckNotMac
+CheckFeature gettext
 
 " Test for package translation Makefile
 func Test_gettext_makefile()
   cd ../po
   if has('win32')
+    if getenv('GETTEXT_PATH') == ''
+      throw 'Skipped: %GETTEXT_PATH% is not set.'
+    endif
     call system('nmake.exe -f Make_mvc.mak "VIMPROG=' .. getenv('VIMPROG') ..
           \ '" "GETTEXT_PATH=' .. getenv('GETTEXT_PATH') ..
           \ '" PLUGPACKAGE=test_gettext
@@ -21,41 +24,45 @@ func Test_gettext_makefile()
           \ ../testdir/test_gettext_makefile_in3.vim
           \ ../testdir/test_gettext_makefile_in4.vim\" test_gettext.pot")
   endif
-  let expected = [
-          \  '# SOME DESCRIPTIVE TITLE.',
-          \  '# Copyright (C) YEAR THE PACKAGE''S COPYRIGHT HOLDER',
-          \  '# This file is distributed under the same license as the 
test_gettext package.',
-          \  '# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.',
-          \  '#',
-          \  '#, fuzzy',
-          \  'msgid ""',
-          \  'msgstr ""',
-          \  '"Project-Id-Version: test_gettext
"',
-          \  '"Report-Msgid-Bugs-To: 
"',
-          \  '"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE
"',
-          \  '"Last-Translator: FULL NAME <EMAIL@ADDRESS>
"',
-          \  '"Language-Team: LANGUAGE <l...@li.org>
"',
-          \  '"Language: 
"',
-          \  '"MIME-Version: 1.0
"',
-          \  '"Content-Type: text/plain; charset=CHARSET
"',
-          \  '"Content-Transfer-Encoding: 8bit
"',
-          \  '',
-          \  '#: ../testdir/test_gettext_makefile_in1.vim:4 
../testdir/test_gettext_makefile_in1.vim:6',
-          \  '#: ../testdir/test_gettext_makefile_in2.vim:5 
../testdir/test_gettext_makefile_in4.vim:4',
-          \  'msgid "This is a test"',
-          \  'msgstr ""',
-          \  '',
-          \  '#: ../testdir/test_gettext_makefile_in1.vim:5',
-          \  'msgid "This is another test"',
-          \  'msgstr ""',
-          \  '',
-          \  '#: ../testdir/test_gettext_makefile_in2.vim:4',
-          \  'msgid "This is a test from the second file"',
-          \  'msgstr ""',
-          \  '',
-          \  '#: ../testdir/test_gettext_makefile_in4.vim:5',
-          \  'msgid "This is a fourth test"',
-          \  'msgstr ""']
+  if v:shell_error != 0
+    throw 'Fail to create test_gettext.pot. Error code: ' .. v:shell_error
+  endif
+  let expected =<< trim END
+    # SOME DESCRIPTIVE TITLE.
+    # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+    # This file is distributed under the same license as the test_gettext 
package.
+    # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+    #
+    #, fuzzy
+    msgid ""
+    msgstr ""
+    "Project-Id-Version: test_gettext
"
+    "Report-Msgid-Bugs-To: 
"
+    "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE
"
+    "Last-Translator: FULL NAME <EMAIL@ADDRESS>
"
+    "Language-Team: LANGUAGE <l...@li.org>
"
+    "Language: 
"
+    "MIME-Version: 1.0
"
+    "Content-Type: text/plain; charset=CHARSET
"
+    "Content-Transfer-Encoding: 8bit
"
+
+    #: ../testdir/test_gettext_makefile_in1.vim:4 
../testdir/test_gettext_makefile_in1.vim:6
+    #: ../testdir/test_gettext_makefile_in2.vim:5 
../testdir/test_gettext_makefile_in4.vim:4
+    msgid "This is a test"
+    msgstr ""
+
+    #: ../testdir/test_gettext_makefile_in1.vim:5
+    msgid "This is another test"
+    msgstr ""
+
+    #: ../testdir/test_gettext_makefile_in2.vim:4
+    msgid "This is a test from the second file"
+    msgstr ""
+
+    #: ../testdir/test_gettext_makefile_in4.vim:5
+    msgid "This is a fourth test"
+    msgstr ""
+  END
   let potfile = filter(readfile("test_gettext.pot"), 'v:val !~ 
"POT-Creation-Date"')
   call assert_equal(expected, potfile)
   call delete('test_gettext.pot')
diff --git a/src/version.c b/src/version.c
index 4c6ed9960..2003f5336 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    570,
 /**/
     569,
 /**/

-- 
-- 
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 on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1sS95j-001H6j-8y%40256bit.org.

Raspunde prin e-mail lui