Restructuring tests
This commit is contained in:
22
precommit-hooks/coverage.bash
Normal file
22
precommit-hooks/coverage.bash
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Find that we have tests for each file.
|
||||
|
||||
retcode=0
|
||||
for language in `ls -1 ./HelloWorld.* | cut -f 3 -d '.'`; do
|
||||
|
||||
# Ensure there's a test file.
|
||||
if [ ! -f tests/test_"${language}".py ]; then
|
||||
echo "${language^} is missing a test file."
|
||||
retcode=1
|
||||
else
|
||||
# Ensure that each test is defined.
|
||||
if ! grep "^def test_${language}():$" tests/test_"${language}".py &>/dev/null; then
|
||||
echo "${language^} doesn't have the right test definition."
|
||||
retcode=1
|
||||
fi
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
exit $retcode
|
Reference in New Issue
Block a user