1
0
forked from aniani/vim

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 <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Ken Takata
2024-07-12 07:35:36 +02:00
committed by Christian Brabandt
parent 7347642633
commit 8a7563bbea
2 changed files with 45 additions and 36 deletions

View File

@@ -1,11 +1,14 @@
source check.vim source check.vim
"CheckNotMSWindows
CheckNotMac CheckNotMac
CheckFeature gettext
" Test for package translation Makefile " Test for package translation Makefile
func Test_gettext_makefile() func Test_gettext_makefile()
cd ../po cd ../po
if has('win32') 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') .. call system('nmake.exe -f Make_mvc.mak "VIMPROG=' .. getenv('VIMPROG') ..
\ '" "GETTEXT_PATH=' .. getenv('GETTEXT_PATH') .. \ '" "GETTEXT_PATH=' .. getenv('GETTEXT_PATH') ..
\ '" PLUGPACKAGE=test_gettext \ '" PLUGPACKAGE=test_gettext
@@ -21,41 +24,45 @@ func Test_gettext_makefile()
\ ../testdir/test_gettext_makefile_in3.vim \ ../testdir/test_gettext_makefile_in3.vim
\ ../testdir/test_gettext_makefile_in4.vim\" test_gettext.pot") \ ../testdir/test_gettext_makefile_in4.vim\" test_gettext.pot")
endif endif
let expected = [ if v:shell_error != 0
\ '# SOME DESCRIPTIVE TITLE.', throw 'Fail to create test_gettext.pot. Error code: ' .. v:shell_error
\ '# Copyright (C) YEAR THE PACKAGE''S COPYRIGHT HOLDER', endif
\ '# This file is distributed under the same license as the test_gettext package.', let expected =<< trim END
\ '# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.', # SOME DESCRIPTIVE TITLE.
\ '#', # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
\ '#, fuzzy', # This file is distributed under the same license as the test_gettext package.
\ 'msgid ""', # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
\ 'msgstr ""', #
\ '"Project-Id-Version: test_gettext\n"', #, fuzzy
\ '"Report-Msgid-Bugs-To: \n"', msgid ""
\ '"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"', msgstr ""
\ '"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"', "Project-Id-Version: test_gettext\n"
\ '"Language-Team: LANGUAGE <LL@li.org>\n"', "Report-Msgid-Bugs-To: \n"
\ '"Language: \n"', "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
\ '"MIME-Version: 1.0\n"', "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
\ '"Content-Type: text/plain; charset=CHARSET\n"', "Language-Team: LANGUAGE <LL@li.org>\n"
\ '"Content-Transfer-Encoding: 8bit\n"', "Language: \n"
\ '', "MIME-Version: 1.0\n"
\ '#: ../testdir/test_gettext_makefile_in1.vim:4 ../testdir/test_gettext_makefile_in1.vim:6', "Content-Type: text/plain; charset=CHARSET\n"
\ '#: ../testdir/test_gettext_makefile_in2.vim:5 ../testdir/test_gettext_makefile_in4.vim:4', "Content-Transfer-Encoding: 8bit\n"
\ 'msgid "This is a test"',
\ 'msgstr ""', #: ../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
\ '#: ../testdir/test_gettext_makefile_in1.vim:5', msgid "This is a test"
\ 'msgid "This is another test"', msgstr ""
\ 'msgstr ""',
\ '', #: ../testdir/test_gettext_makefile_in1.vim:5
\ '#: ../testdir/test_gettext_makefile_in2.vim:4', msgid "This is another test"
\ 'msgid "This is a test from the second file"', msgstr ""
\ 'msgstr ""',
\ '', #: ../testdir/test_gettext_makefile_in2.vim:4
\ '#: ../testdir/test_gettext_makefile_in4.vim:5', msgid "This is a test from the second file"
\ 'msgid "This is a fourth test"', msgstr ""
\ '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"') let potfile = filter(readfile("test_gettext.pot"), 'v:val !~ "POT-Creation-Date"')
call assert_equal(expected, potfile) call assert_equal(expected, potfile)
call delete('test_gettext.pot') call delete('test_gettext.pot')

View File

@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
570,
/**/ /**/
569, 569,
/**/ /**/