1#!/usr/bin/env bash
2
3set -uo pipefail
4
5cd "$( dirname "${BASH_SOURCE[0]}" )"
6
7export STACK_ROOT=$HOME/.stack
8unset GHC_PACKAGE_PATH
9
10DIR=$(pwd)
11STACK=$(stack exec which stack)
12
13export SRC_DIR=$DIR/../../
14export TEST_DIR=$DIR/tests/$1
15
16if [[ ! -d "tests/$1" ]]
17then
18    echo Test does not exist: $1
19    exit 1
20fi
21
22mkdir -p tests/$1/files
23cd tests/$1/files
24echo Running test $1
25exec $STACK --stack-yaml $DIR/../../stack.yaml runghc --no-ghc-package-path -- -i../../../lib ../Main.hs
26