added test script

This commit is contained in:
Lucas Frérot 2024-12-31 13:36:00 +01:00
parent 38eecf81eb
commit 68683c9c97
No known key found for this signature in database
GPG Key ID: 03B54A50E3FBA7E8
1 changed files with 43 additions and 0 deletions

43
tests/run_all_tests Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -euo pipefail
source ../rtenets
test_init-tree() {
info "running test_init-tree"
init-tree .
# Test directory is a git repo
\git status > /dev/null 2>&1 \
|| ( echo "git failed: $PWD is not a repo"; exit 1 )
# Test config values
[[ "$(\git config user.name)" != "" ]] \
&& [[ "$(\git config user.email)" != "" ]] \
|| ( echo "git config failed"; exit 1 )
# Test file structure
mandatory_files=("README.md~"
"AUTHORS"
"COPYING"
"make_all_figures"
"tests/run_all_tests")
for file in ${mandatory_files[*]}; do
[[ -f "${file}" ]] || ( echo "file ${file} is missig"; exit 1 )
done
info "finished test_init-tree"
}
main() {
readonly PROJECT_NAME="TMP PROJECT"
readonly PROJECT_DESC="TMP DESCRIPTION"
local tmpdir="$(mktemp -d)"
(
cd "${tmpdir}"
test_init-tree
)
}
main "$@"