From a4d9c5b39bbd59dc00a29bae34b9fee94c97b28e Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Sat, 28 Dec 2013 15:04:41 +0100 Subject: [PATCH] Add more tests. --- test.sh | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 6 deletions(-) diff --git a/test.sh b/test.sh index 188c018..1de773a 100755 --- a/test.sh +++ b/test.sh @@ -4,15 +4,67 @@ PATH=./bin:$PATH set -e +KOOK_TEST_CONFIG="$(pwd)/test.config.yml" +KOOK_OPTS="--verbose --config $KOOK_TEST_CONFIG" +TEST_TITLE="" + fail() { - set +x - echo "ERROR: $*" + echo "ERROR: $TEST_TITLE" exit 1 } -set -x +test_cleanup() { + rm -f $KOOK_TEST_CONFIG + rm -f Kookfile +} -kook project add kook1 . || fail "test1" -kook project add kook2 || fail "test2" -kook project list || fail "test3" +test_start() { + test_cleanup + TEST_TITLE="$*" + echo "" + echo "" + echo "## TEST : $TEST_TITLE" + echo "" +} +test_start "Simple project listing" +kook project list $KOOK_OPTS || fail + +test_start "Add project (explicit pah)" +kook project add kook-project $KOOK_OPTS --path . || fail +kook project list $KOOK_OPTS || fail + +test_start "Add project (auto path)" +kook project add kook-project $KOOK_OPTS || fail +kook project list $KOOK_OPTS || fail + +test_start "Add and remove project" +kook project add kook-project $KOOK_OPTS || fail +kook project list $KOOK_OPTS || fail +kook project rm kook-project $KOOK_OPTS || fail +kook project list $KOOK_OPTS || fail + +test_start "Detect current project" +kook project add kook-project $KOOK_OPTS || fail +kook project list $KOOK_OPTS || fail +kook project detect $KOOK_OPTS || fail + +test_start "Simple view listing (explicit project)" +kook project add kook-project $KOOK_OPTS || fail +kook view list $KOOK_OPTS --project kook-project || fail + +#test_start "Simple view listing (implicit project)" +#kook project add kook-project $KOOK_OPTS || fail +#kook view list $KOOK_OPTS || fail + +test_start "Fire a project with no view" +kook project add kook-project $KOOK_OPTS || fail +kook view list $KOOK_OPTS || fail +kook fire kook-project $KOOK_OPTS || fail + +test_start "Add a project with a view (explicit project)" +kook project add kook-project $KOOK_OPTS || fail +kook view add root $KOOK_OPTS --project kook-project || fail +kook view list $KOOK_OPTS --project kook-project || fail + +test_cleanup