RestorerZ | 9650910 | 2024-07-11 21:14:15 +0200 | [diff] [blame] | 1 | source check.vim |
RestorerZ | 9650910 | 2024-07-11 21:14:15 +0200 | [diff] [blame] | 2 | CheckNotMac |
Ken Takata | 8a7563b | 2024-07-12 07:35:36 +0200 | [diff] [blame^] | 3 | CheckFeature gettext |
RestorerZ | 9650910 | 2024-07-11 21:14:15 +0200 | [diff] [blame] | 4 | |
| 5 | " Test for package translation Makefile |
| 6 | func Test_gettext_makefile() |
| 7 | cd ../po |
| 8 | if has('win32') |
Ken Takata | 8a7563b | 2024-07-12 07:35:36 +0200 | [diff] [blame^] | 9 | if getenv('GETTEXT_PATH') == '' |
| 10 | throw 'Skipped: %GETTEXT_PATH% is not set.' |
| 11 | endif |
RestorerZ | 9650910 | 2024-07-11 21:14:15 +0200 | [diff] [blame] | 12 | 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 Takata | 8a7563b | 2024-07-12 07:35:36 +0200 | [diff] [blame^] | 27 | 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 |
RestorerZ | 9650910 | 2024-07-11 21:14:15 +0200 | [diff] [blame] | 66 | 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 - |
| 70 | endfunc |
| 71 | |
| 72 | " vim: shiftwidth=2 sts=2 expandtab |