#!/bin/bash # init the "game" and profile export GSGP_ID=gsgptest export GSGP_TITLE="Test Suite" export GSGP_PROFILE=TEST export GSGP_PROFILE_PATH=/tmp/gsgp-test . "$( dirname $0 )/../util/common" # annihilate profile to start fresh rm -rf "$GSGP_PROFILE_PATH" mkdir -p "$GSGP_PROFILE_PATH" # add util to path PATH="$( cd "$( dirname $0 )/../util" && pwd ):$PATH" lastgiven='' lastexpected='' last() { lastgiven="$1" lastexpected="$2" } assert-equal() { last "$1" "$2" [ "$1" == "$2" ] } assert-eq() { last "$1" "$2" [ $1 -eq $2 ] } assert-no-exist() { last "$1 exists" "$1 to not exist" [ ! -e "$1" ] } assert-contains() { grep -qsP "$1" <<< "$2" } simplefail() { echo "FAILURE: $1" >&2 } fail() { simplefail "$1" echo "Expected '$lastexpected', but received '$lastgiven'" >&2 echo >&2 }