mirror of
https://github.com/troglobit/finit.git
synced 2026-11-03 13:28:27 +00:00
test: Add support for teardown in tests
If a test defines a function 'test_teardown(), that function will be called before the test env teardown is run. Signed-off-by: Magnus Malm <magnusmalm@gmail.com>
This commit is contained in:
1 parent
70773105ac
commit
4480010d4a
2 files changed
+13
-3
No files matched your search
@@ -69,6 +69,11 @@ say() {
|
||||
|
||||
teardown() {
|
||||
test_status="$?"
|
||||
|
||||
if type test_teardown > /dev/null 2>&1 ; then
|
||||
test_teardown
|
||||
fi
|
||||
|
||||
log "$color_reset" '--' ''
|
||||
if [ "$test_status" -eq 0 ]; then
|
||||
log "$fg_green" 'TEST PASS' ''
|
||||
|
||||
Reference in new issue
Block a user