#!/bin/sh

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

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

tmpfiles="$tmpfiles xg-sc-1.scm"
cat <<EOF > xg-sc-1.scm
; This comment will not be extracted.
(display (_ "help"))
;;  TRANSLATORS: This is an extracted comment.
(display (_ "me"))
#!  Not extracted either.
!#
(display (_ "The Fabulous Four"))
EOF

tmpfiles="$tmpfiles xg-sc-1.po"
: ${XGETTEXT=xgettext}
${XGETTEXT} -k_ --omit-header --no-location --add-comments=TRANSLATORS: \
  -d xg-sc-1 xg-sc-1.scm
test $? = 0 || { rm -fr $tmpfiles; exit 1; }

tmpfiles="$tmpfiles xg-sc-1.ok"
cat <<EOF > xg-sc-1.ok
msgid "help"
msgstr ""

#. TRANSLATORS: This is an extracted comment.
msgid "me"
msgstr ""

msgid "The Fabulous Four"
msgstr ""
EOF

: ${DIFF=diff}
${DIFF} xg-sc-1.ok xg-sc-1.po
result=$?

rm -fr $tmpfiles

exit $result
