diff options
| author | Egor Tensin <egor@tensin.name> | 2026-10-14 17:18:39 +0500 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-10-14 17:27:42 +0500 |
| commit | af2ea0bd8749a20e085f2d1c7483e1ed7829ba76 (patch) | |
| tree | 1bc722b61d53fb67d7ad74bdc2124b569f6bee9f /lib/test.sh | |
| parent | add LICENSE.txt (diff) | |
| download | test-harness-af2ea0bd8749a20e085f2d1c7483e1ed7829ba76.tar.gz test-harness-af2ea0bd8749a20e085f2d1c7483e1ed7829ba76.zip | |
import main files from tag-release
I'm using an identical pattern in a number of projects now, so I'm
factoring this out into a separate repo.
Diffstat (limited to 'lib/test.sh')
| -rw-r--r-- | lib/test.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/test.sh b/lib/test.sh new file mode 100644 index 0000000..fc4f1a6 --- /dev/null +++ b/lib/test.sh @@ -0,0 +1,21 @@ +# Copyright (c) 2026 Egor Tensin <egor@tensin.name> +# This file is part of the "test-harness" project. +# For details, see https://github.com/egor-tensin/test-harness +# Distributed under the MIT License. + +test_should_fail= +test_root_dir= + +test_setup_global() { + test_root_dir="$( mktemp -d )" +} + +test_cleanup_global() { + if [ "$( type -t test_cleanup )" == function ]; then + test_cleanup || true + fi + if [ -n "$test_root_dir" ]; then + log "Removing test's root directory: $test_root_dir" + rm -rf -- "$test_root_dir" + fi +} |
