#!/bin/sh

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

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

tmpfiles="$tmpfiles xg-el-2.el"
cat <<\EOF > xg-el-2.el
; a
(setq string ; b
; c
(_ ; d
"hello world" ; e
; f
))
EOF

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

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

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

rm -fr $tmpfiles

exit $result
