summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_gettext_make.vim
blob: 22b04745e0279a079de831040bcb33e2cc5c4cef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
source check.vim
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
          \ "PO_PLUG_INPUTLIST=..\testdir\test_gettext_makefile_in1.vim
          \ ..\testdir\test_gettext_makefile_in2.vim
          \ ..\testdir\test_gettext_makefile_in3.vim
          \ ..\testdir\test_gettext_makefile_in4.vim" test_gettext.pot')
  else
" Will it work on macOS?
    call system("make -f Makefile PLUGPACKAGE=test_gettext
          \ PO_PLUG_INPUTLIST=\"../testdir/test_gettext_makefile_in1.vim
          \ ../testdir/test_gettext_makefile_in2.vim
          \ ../testdir/test_gettext_makefile_in3.vim
          \ ../testdir/test_gettext_makefile_in4.vim\" test_gettext.pot")
  endif
  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\n"
    "Report-Msgid-Bugs-To: \n"
    "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    "Language-Team: LANGUAGE <LL@li.org>\n"
    "Language: \n"
    "MIME-Version: 1.0\n"
    "Content-Type: text/plain; charset=CHARSET\n"
    "Content-Transfer-Encoding: 8bit\n"

    #: ../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')
  cd -
endfunc

" vim: shiftwidth=2 sts=2 expandtab