#!/bin/sh -e

pkg=r-cran-r.cache
if [ "$ADTTMP" = "" ] ; then
  ADTTMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
fi
cd $ADTTMP
cp -a /usr/share/doc/${pkg}/tests/* $ADTTMP
find . -name "*.gz" -exec gunzip \{\} \;
export LC_ALL=C
for test in *R
do
  R --no-save < ${test}
  echo "Test ${test} passed"
done
rm -f $ADTTMP/*
