# setup paths for BATS test units
setup() {
    bats_require_minimum_version 1.5.0
    T="$BATS_TEST_DIRNAME"
    TMP="$BATS_TEST_TMPDIR"
	#    R=`cd "$T"/.. && pwd`
	R=`pwd`
    load "$T"/test_helper/bats_support/load
    load "$T"/test_helper/bats_assert/load
	CJIT="${R}/cjit"
	[ -r "$CJIT" ] || CJIT="${R}/cjit.exe"
	[ -r "$CJIT" ] || CJIT="${R}/cjit.command"
	[ -r "$CJIT" ] || {
	  >&2 echo "CJIT is not built, cannot run test suite"
	  exit 1
	}
	${CJIT} -v 2>&1| grep 'System libtcc' >/dev/null && SYSTCC=1
	if [ -z "${SYSTCC:-}" ]; then
		rm -rf `${CJIT} --xass`
	fi
	TCC="${R}/lib/tinycc/tcc"
	[ -r "$TCC" ]    || TCC="${R}/lib/tinycc/tcc.exe"
	unset CFLAGS
}

skip_if_systcc_execute_is_unavailable() {
	if [ -n "${SYSTCC:-}" ]; then
		skip "in-memory execute routes are unavailable with the Debian shared libtcc build"
	fi
}

skip_if_windows_stdin_is_unsupported() {
	case "$(uname -s)" in
		MINGW*|MSYS*|CYGWIN*)
			skip "stdin execute route is unsupported on Windows"
			;;
	esac
}
