#!/bin/sh -e

pkgname=lexRankr
debname=r-cran-lexrankr

if [ "$AUTOPKGTEST_TMP" = "" ] ; then
    AUTOPKGTEST_TMP=`mktemp -d /tmp/${debname}-test.XXXXXX`
    trap "rm -rf $AUTOPKGTEST_TMP" 0 INT QUIT ABRT PIPE TERM
fi
cd $AUTOPKGTEST_TMP
cp -a /usr/share/doc/$debname/tests/* $AUTOPKGTEST_TMP
gunzip -r *

hostarch=$(dpkg-architecture -qDEB_HOST_ARCH)
# Ignore single test for i386 architecture.  This is a workaround for bug #1024828 of r-cran-igraph
if [ "$hostarch" = "i386" ] ; then
  sed -i '/^test_that("object out value",/,/^})/d' testthat/test-lexRank.R
fi

for testfile in *.R; do
    echo "BEGIN TEST $testfile"
    LC_ALL=C R --no-save < $testfile
done

