#!/bin/sh
#
# Test with wrong ISO-8859-1 (Latin1) German words.
#
# (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

cat $TESTSDIR/typo.utf8.txt $TESTSDIR/austriazismen.utf8.txt \
    $TESTSDIR/helvetismen.utf8.txt \
    | iconv -f UTF-8 -t ISO-8859-1 > $ADTTMP/typo.latin1.txt

ispell -l -w '' -Tlatin1 -d ngerman < $ADTTMP/typo.latin1.txt \
                                           > $ADTTMP/ispell.typo.out

if diff $ADTTMP/ispell.typo.out $ADTTMP/typo.latin1.txt \
	> $ADTTMP/diff.typo.out
then
    exit 0
else
    echo "following words are wrongly accepted:"
    grep -a '^>' $ADTTMP/diff.typo.out
    exit 1
fi
