xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/xgettext-awk-1 (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1#!/bin/sh
2
3# Test awk support: --add-comments option.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8tmpfiles="$tmpfiles xg-a-1.awk"
9cat <<EOF > xg-a-1.awk
10# This comment will not be extracted.
11print _"help"
12#  TRANSLATORS: This is an extracted comment.
13print _"me"
14# Not extracted either.
15print _"Hey Jude"
16# TRANSLATORS:
17#    Nickname of the Beatles
18print _"The Fabulous Four"
19EOF
20
21tmpfiles="$tmpfiles xg-a-1.po"
22: ${XGETTEXT=xgettext}
23${XGETTEXT} --omit-header --no-location --add-comments=TRANSLATORS: \
24  -d xg-a-1 xg-a-1.awk
25test $? = 0 || { rm -fr $tmpfiles; exit 1; }
26
27tmpfiles="$tmpfiles xg-a-1.ok"
28cat <<EOF > xg-a-1.ok
29msgid "help"
30msgstr ""
31
32#. TRANSLATORS: This is an extracted comment.
33msgid "me"
34msgstr ""
35
36msgid "Hey Jude"
37msgstr ""
38
39#. TRANSLATORS:
40#. Nickname of the Beatles
41msgid "The Fabulous Four"
42msgstr ""
43EOF
44
45: ${DIFF=diff}
46${DIFF} xg-a-1.ok xg-a-1.po
47result=$?
48
49rm -fr $tmpfiles
50
51exit $result
52