Wetitpig
6 years ago
committed by
Leonid Plyushch
25 changed files with 134 additions and 134 deletions
@ -1,42 +1,42 @@ |
|||||
#!/data/data/com.termux/files/usr/bin/bash |
#!/data/data/com.termux/files/usr/bin/bash |
||||
|
|
||||
if [ $# != 1 ]; then |
if [ $# != 1 ]; then |
||||
echo "Specify package to run tests for as only argument" |
echo "Specify package to run tests for as only argument" |
||||
exit 1 |
exit 1 |
||||
fi |
fi |
||||
|
|
||||
PACKAGE=$1 |
PACKAGE=$1 |
||||
TEST_DIR=packages/$PACKAGE/tests |
TEST_DIR=packages/$PACKAGE/tests |
||||
|
|
||||
if [ ! -d $TEST_DIR ]; then |
if [ ! -d $TEST_DIR ]; then |
||||
echo "ERROR: No tests folder for package $PACKAGE" |
echo "ERROR: No tests folder for package $PACKAGE" |
||||
exit 1 |
exit 1 |
||||
fi |
fi |
||||
|
|
||||
NUM_TESTS=0 |
NUM_TESTS=0 |
||||
NUM_FAILURES=0 |
NUM_FAILURES=0 |
||||
|
|
||||
for TEST_SCRIPT in $TEST_DIR/*; do |
for TEST_SCRIPT in $TEST_DIR/*; do |
||||
test -t 1 && printf "\033[32m" |
test -t 1 && printf "\033[32m" |
||||
echo "Running test ${TEST_SCRIPT}..." |
echo "Running test ${TEST_SCRIPT}..." |
||||
(( NUM_TESTS += 1 )) |
(( NUM_TESTS += 1 )) |
||||
test -t 1 && printf "\033[31m" |
test -t 1 && printf "\033[31m" |
||||
( |
( |
||||
assert_equals() { |
assert_equals() { |
||||
FIRST=$1 |
FIRST=$1 |
||||
SECOND=$2 |
SECOND=$2 |
||||
if [ "$FIRST" != "$SECOND" ]; then |
if [ "$FIRST" != "$SECOND" ]; then |
||||
echo "assertion failed - expected '$FIRST', got '$SECOND'" |
echo "assertion failed - expected '$FIRST', got '$SECOND'" |
||||
exit 1 |
exit 1 |
||||
fi |
fi |
||||
} |
} |
||||
set -e -u |
set -e -u |
||||
. $TEST_SCRIPT |
. $TEST_SCRIPT |
||||
) |
) |
||||
if [ $? != 0 ]; then |
if [ $? != 0 ]; then |
||||
(( NUM_FAILURES += 1 )) |
(( NUM_FAILURES += 1 )) |
||||
fi |
fi |
||||
test -t 1 && printf "\033[0m" |
test -t 1 && printf "\033[0m" |
||||
done |
done |
||||
|
|
||||
echo "$NUM_TESTS tests run - $NUM_FAILURES failure(s)" |
echo "$NUM_TESTS tests run - $NUM_FAILURES failure(s)" |
||||
|
Loading…
Reference in new issue