Skip to content

Commit 91eb0d0

Browse files
committed
ADD setup_suite and teardown_suite
This functions are executed before and after all tests in a test file.
1 parent de0130a commit 91eb0d0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

bash_unit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ stacktrace() {
138138
run_test_suite() {
139139
local failure=0
140140

141+
declare -F | grep ' setup_suite$' >/dev/null && setup_suite
142+
141143
for pending_test in $(set | grep -E '^(pending|todo).* \(\)' | grep -E "$test_pattern" | sed -e 's: .*::')
142144
do
143145
notify_test_starting "$pending_test"
@@ -156,6 +158,9 @@ run_test_suite() {
156158
)
157159
failure=$(( $? || failure))
158160
done
161+
162+
declare -F | grep ' teardown_suite$' >/dev/null && teardown_suite
163+
159164
return $failure
160165
}
161166

0 commit comments

Comments
 (0)