blob: 860aa2c65be86b972579916518318f0cf310c4bb [file] [log] [blame]
RestorerZ96509102024-07-11 21:14:15 +02001source check.vim
RestorerZ96509102024-07-11 21:14:15 +02002CheckNotMac
Ken Takata8a7563b2024-07-12 07:35:36 +02003CheckFeature gettext
RestorerZ96509102024-07-11 21:14:15 +02004
5" Test for package translation Makefile
6func Test_gettext_makefile()
7 cd ../po
8 if has('win32')
Ken Takata71de2592024-07-13 18:56:25 +02009 if getenv('GETTEXT_PATH') == v:null
Ken Takata8a7563b2024-07-12 07:35:36 +020010 throw 'Skipped: %GETTEXT_PATH% is not set.'
11 endif
RestorerZ96509102024-07-11 21:14:15 +020012 call system('nmake.exe -f Make_mvc.mak "VIMPROG=' .. getenv('VIMPROG') ..
13 \ '" "GETTEXT_PATH=' .. getenv('GETTEXT_PATH') ..
14 \ '" PLUGPACKAGE=test_gettext
15 \ "PO_PLUG_INPUTLIST=..\testdir\test_gettext_makefile_in1.vim
16 \ ..\testdir\test_gettext_makefile_in2.vim
17 \ ..\testdir\test_gettext_makefile_in3.vim
18 \ ..\testdir\test_gettext_makefile_in4.vim" test_gettext.pot')
19 else
20" Will it work on macOS?
James McCoy3db32d22024-09-03 22:50:38 +020021 CheckExecutable xgettext
RestorerZ96509102024-07-11 21:14:15 +020022 call system("make -f Makefile PLUGPACKAGE=test_gettext
23 \ PO_PLUG_INPUTLIST=\"../testdir/test_gettext_makefile_in1.vim
24 \ ../testdir/test_gettext_makefile_in2.vim
25 \ ../testdir/test_gettext_makefile_in3.vim
26 \ ../testdir/test_gettext_makefile_in4.vim\" test_gettext.pot")
27 endif
Ken Takata8a7563b2024-07-12 07:35:36 +020028 if v:shell_error != 0
29 throw 'Fail to create test_gettext.pot. Error code: ' .. v:shell_error
30 endif
31 let expected =<< trim END
32 # SOME DESCRIPTIVE TITLE.
33 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
34 # This file is distributed under the same license as the test_gettext package.
35 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
36 #
37 #, fuzzy
38 msgid ""
39 msgstr ""
40 "Project-Id-Version: test_gettext\n"
41 "Report-Msgid-Bugs-To: \n"
42 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
43 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
44 "Language-Team: LANGUAGE <LL@li.org>\n"
45 "Language: \n"
46 "MIME-Version: 1.0\n"
47 "Content-Type: text/plain; charset=CHARSET\n"
48 "Content-Transfer-Encoding: 8bit\n"
49
50 #: ../testdir/test_gettext_makefile_in1.vim:4 ../testdir/test_gettext_makefile_in1.vim:6
51 #: ../testdir/test_gettext_makefile_in2.vim:5 ../testdir/test_gettext_makefile_in4.vim:4
52 msgid "This is a test"
53 msgstr ""
54
55 #: ../testdir/test_gettext_makefile_in1.vim:5
56 msgid "This is another test"
57 msgstr ""
58
59 #: ../testdir/test_gettext_makefile_in2.vim:4
60 msgid "This is a test from the second file"
61 msgstr ""
62
63 #: ../testdir/test_gettext_makefile_in4.vim:5
64 msgid "This is a fourth test"
65 msgstr ""
66 END
RestorerZ96509102024-07-11 21:14:15 +020067 let potfile = filter(readfile("test_gettext.pot"), 'v:val !~ "POT-Creation-Date"')
68 call assert_equal(expected, potfile)
69 call delete('test_gettext.pot')
70 cd -
71endfunc
72
73" vim: shiftwidth=2 sts=2 expandtab