#!/bin/sh -e

pkg=shapes
debname=r-cran-shapes

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/lib/R/site-library/${pkg}/demo/shapes.R $AUTOPKGTEST_TMP

# Load library before running tests
echo 'library("shapes")' > shapes_test.R
cat shapes.R >> shapes_test.R
mv shapes_test.R shapes.R

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

