#!/bin/sh
set -e

# Create the example package
cd debian/tests
cp Setup.hs example.cabal example.hs $ADTTMP
cd $ADTTMP
mkdir example
mv Setup.hs example.cabal example.hs example
cd example
touch LICENSE.txt # Cabal expects this

CABAL="cabal --config-file=/dev/null"

# These tests are needed to make sure the cabal libraries used to compile
# cabal-install and hgettext are compatible.
# Test whether we can configure this
$CABAL configure
# Test whether we can build this
$CABAL build
# Test whether we can compile to repl
/bin/echo -e 'putStrLn "works"\n:quit' | $CABAL repl
# Test whether we can install
mkdir $ADTTMP/test-install
$CABAL install --prefix $ADTTMP/test-install
