blob: 22b04745e0279a079de831040bcb33e2cc5c4cef [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 Takata8a7563b2024-07-12 07:35:36 +02009 if getenv('GETTEXT_PATH') == ''
10 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?
21 call system("make -f Makefile PLUGPACKAGE=test_gettext
22 \ PO_PLUG_INPUTLIST=\"../testdir/test_gettext_makefile_in1.vim
23 \ ../testdir/test_gettext_makefile_in2.vim
24 \ ../testdir/test_gettext_makefile_in3.vim
25 \ ../testdir/test_gettext_makefile_in4.vim\" test_gettext.pot")
26 endif
Ken Takata8a7563b2024-07-12 07:35:36 +020027 if v:shell_error != 0
28 throw 'Fail to create test_gettext.pot. Error code: ' .. v:shell_error
29 endif
30 let expected =<< trim END
31 # SOME DESCRIPTIVE TITLE.
32 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
33 # This file is distributed under the same license as the test_gettext package.
34 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
35 #
36 #, fuzzy
37 msgid ""
38 msgstr ""
39 "Project-Id-Version: test_gettext\n"
40 "Report-Msgid-Bugs-To: \n"
41 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
42 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
43 "Language-Team: LANGUAGE <LL@li.org>\n"
44 "Language: \n"
45 "MIME-Version: 1.0\n"
46 "Content-Type: text/plain; charset=CHARSET\n"
47 "Content-Transfer-Encoding: 8bit\n"
48
49 #: ../testdir/test_gettext_makefile_in1.vim:4 ../testdir/test_gettext_makefile_in1.vim:6
50 #: ../testdir/test_gettext_makefile_in2.vim:5 ../testdir/test_gettext_makefile_in4.vim:4
51 msgid "This is a test"
52 msgstr ""
53
54 #: ../testdir/test_gettext_makefile_in1.vim:5
55 msgid "This is another test"
56 msgstr ""
57
58 #: ../testdir/test_gettext_makefile_in2.vim:4
59 msgid "This is a test from the second file"
60 msgstr ""
61
62 #: ../testdir/test_gettext_makefile_in4.vim:5
63 msgid "This is a fourth test"
64 msgstr ""
65 END
RestorerZ96509102024-07-11 21:14:15 +020066 let potfile = filter(readfile("test_gettext.pot"), 'v:val !~ "POT-Creation-Date"')
67 call assert_equal(expected, potfile)
68 call delete('test_gettext.pot')
69 cd -
70endfunc
71
72" vim: shiftwidth=2 sts=2 expandtab