#!/bin/bash

[ "$TEST_VERBOSE" ] || TEST_VERBOSE=0
log() {
	if [ $TEST_VERBOSE -gt 1 ]; then
		echo "$@" 1>&2
	fi
}

NONINTERACTIVE="yes"

test="$1"
DIR=$PWD
TEST_DIR=$PWD/$(dirname "$test")
tmp=/tmp/do-test.$$
. $test.test "$tmp"
cd $DIR
if $(cmp -s $test.expected $tmp); then
	rm -f $tmp
	exit 0
else
	if [ $TEST_VERBOSE ]; then
		diff -urN $test.expected $tmp 1>&2
	fi
	rm -f $tmp
	exit 1
fi

