#!/bin/sh

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

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

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

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

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

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

rm -fr $tmpfiles

exit $result