#!/bin/sh

# Test awk support: --add-comments option.

tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15

tmpfiles="$tmpfiles xg-a-2.awk"
cat <<\EOF > xg-a-2.awk
# a
string = # b
# c
_"hello world" # d
# e
;
EOF

tmpfiles="$tmpfiles xg-a-2.tmp.po xg-a-2.po"
: ${XGETTEXT=xgettext}
${XGETTEXT} --add-comments --omit-header --no-location --keyword=_ \
  -d xg-a-2.tmp xg-a-2.awk
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
LC_ALL=C tr -d '\r' < xg-a-2.tmp.po > xg-a-2.po
test $? = 0 || { rm -fr $tmpfiles; exit 1; }

tmpfiles="$tmpfiles xg-a-2.ok"
cat <<EOF > xg-a-2.ok
#. a
#. b
#. c
msgid "hello world"
msgstr ""
EOF

: ${DIFF=diff}
${DIFF} xg-a-2.ok xg-a-2.po
result=$?

rm -fr $tmpfiles

exit $result
