Imported Upstream version 0.18.1.1
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-librep-1
1 #!/bin/sh
2
3 # Test librep support: --add-comments option.
4
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
7
8 tmpfiles="$tmpfiles xg-lr-1.jl"
9 cat <<EOF > xg-lr-1.jl
10 ; This comment will not be extracted.
11 (princ (_ "help"))
12 ;;  TRANSLATORS: This is an extracted comment.
13 (princ (_ "me"))
14 #| Not extracted either. |#
15 (princ (_ "Hey Jude"))
16 #|  TRANSLATORS:
17      Nickname of the Beatles
18 |#
19 (princ (_ "The Fabulous Four"))
20 EOF
21
22 tmpfiles="$tmpfiles xg-lr-1.tmp.po xg-lr-1.po"
23 : ${XGETTEXT=xgettext}
24 ${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
25   -d xg-lr-1.tmp xg-lr-1.jl
26 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
27 LC_ALL=C tr -d '\r' < xg-lr-1.tmp.po > xg-lr-1.po
28 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
29
30 tmpfiles="$tmpfiles xg-lr-1.ok"
31 cat <<EOF > xg-lr-1.ok
32 msgid "help"
33 msgstr ""
34
35 #. TRANSLATORS: This is an extracted comment.
36 msgid "me"
37 msgstr ""
38
39 msgid "Hey Jude"
40 msgstr ""
41
42 #. TRANSLATORS:
43 #. Nickname of the Beatles
44 #.
45 msgid "The Fabulous Four"
46 msgstr ""
47 EOF
48
49 : ${DIFF=diff}
50 ${DIFF} xg-lr-1.ok xg-lr-1.po
51 result=$?
52
53 rm -fr $tmpfiles
54
55 exit $result