#!/bin/sh -e

oname=tibble
pkg=r-cran-`echo $oname | tr [A-Z] [a-z]`

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 \{\} \;
# There is no package r-cran-withr available yet
for testfile in testthat/* ; do
    if grep -q withr $testfile ; then
        rm $testfile
    fi
done
sed -i '/withr/d' testthat.R
LC_ALL=C.UTF-8 R --no-save < testthat.R
rm -fr $ADTTMP/*
