#!/bin/bash

set -xeuo pipefail

tmp="$AUTOPKGTEST_TMP"
ver="$(dpkg-parsechangelog -S version)"
upstream="${ver%%-*}"

rc=0
clojure -e '(System/exit 42)' || rc=$?
test "$rc" -eq 42

cp -a debian/tests/test-app "$tmp"
cd "$tmp/test-app"

out="$(clojure -X test-app/run)"
test "$out" = yep

out="$(clj -X test-app/run)"
test "$out" = yep

out="$(clojure --version)"
test "$out" = "Clojure CLI version $upstream"

out="$(clj --version)"
test "$out" = "Clojure CLI version $upstream"
