#!/bin/sh
#
# Test with a correct ISO-8859-1 (Latin1) Swiss text.
#
# (c) 2018 Roland Rosenfeld <roland@debian.org>

TESTSDIR=$(dirname $0)

if [ -z "$ADTTMP" ]; then
    ADTTMP=$(mktemp -d)
fi

trap "rm -rf $ADTTMP" 0 INT QUIT ABRT PIPE TERM

iconv -f UTF-8 -t ISO-8859-1 < $TESTSDIR/correct.utf8.txt \
      | sed 's//ss/g' > $ADTTMP/correct.latin1.txt

OUTPUT=$(ispell -l -w '' -Tlatin1 -C -d swiss \
		< $ADTTMP/correct.latin1.txt)

if [ -z "$OUTPUT" ]
then
    exit 0
else
    echo "ispell did not accept the following words:"
    echo $OUTPUT
    exit 1
fi
