Added primitive unit testing.
This commit is contained in:
parent
85cc542d74
commit
8026138b9c
8 changed files with 180 additions and 63 deletions
33
unit-tests.sh
Executable file
33
unit-tests.sh
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Early stage unit test runner for post-scarcity software environment.
|
||||
# Uses bash to run every file in the unit-tests subdirectory; expects these
|
||||
# to return 0 on success, anything else on fail.
|
||||
|
||||
# (c) 2017 Simon Brooke <simon@journeyman.cc>
|
||||
# Licensed under GPL version 2.0, or, at your option, any later version.
|
||||
|
||||
tests=0
|
||||
pass=0
|
||||
fail=0
|
||||
|
||||
for file in unit-tests/*
|
||||
do
|
||||
echo ${file}
|
||||
bash ${file}
|
||||
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
pass=$((${pass} + 1))
|
||||
else
|
||||
fail=$((${fail} + 1))
|
||||
fi
|
||||
|
||||
tests=$((${tests} + 1))
|
||||
done
|
||||
|
||||
echo
|
||||
echo "Tested ${tests}, passed ${pass}, failed ${fail}"
|
||||
|
||||
exit ${fail}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue