#!/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

iconv -f UTF-8 -t ISO-8859-1 < $TESTSDIR/typo.utf8.txt > $ADTTMP/typo.latin1.txt

ispell -l -w '' -Tlatin1 -d ogerman < $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 '^>' $ADTTMP/diff.typo.out
    exit 1
fi
