added test script
This commit is contained in:
parent
38eecf81eb
commit
68683c9c97
|
@ -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 "$@"
|
Loading…
Reference in New Issue