From c88a232a4062748a961c0e6bb171b8a727025847 Mon Sep 17 00:00:00 2001 From: Adrian Dvergsdal Date: Mon, 23 Nov 2015 13:37:46 +0100 Subject: [PATCH] Add beforeTest and afterTest in bashunit --- tests/bashunit.bash | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/bashunit.bash b/tests/bashunit.bash index 59dc5b5..139deef 100644 --- a/tests/bashunit.bash +++ b/tests/bashunit.bash @@ -1,3 +1,4 @@ + #!/usr/bin/env bash ######################################################################## @@ -164,8 +165,16 @@ runTests() { exit 0 fi + if [ "$(type -t "beforeTest")" == "function" ]; then + beforeTest + fi + for tc in $testcases ; do $tc ; done + if [ "$(type -t "afterTest")" == "function" ]; then + afterTest + fi + if [ $verbose -ge 1 ] ; then echo "Done. $bashunit_passed passed." \ "$bashunit_failed failed." \