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

TESTSDIR=$(dirname "$0")

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

trap "rm -rf $AUTOPKGTEST_TMP" EXIT

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

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

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