You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
704 B

#!/bin/sh
# Unofficial Bash Strict Mode
set -euo pipefail
IFS='
'
cp -rT /app /jail
if test -v EXPECTED_FILES; then
echo -n "Formatting... "
cd /jail/student
s=$(goimports -d $(echo $EXPECTED_FILES | fmt -w1 | grep '\.go$'))
if test "$s"; then
echo
echo "$s"
exit 1
fi
echo OK
if test -v ALLOWED_FUNCTIONS; then
rc "$EXPECTED_FILES" $ALLOWED_FUNCTIONS
fi
fi
cd /jail
if ! test -f ${EXERCISE}_test.go; then
echo No test file found for the exercise : "$EXERCISE"
exit 1
fi
# TODO: maybe change btree exercises so that they work without student code and then delete this line
find . -name '*_test.go' ! -name ${EXERCISE}_test.go -delete
go test -failfast -run=\(?i\)test${EXERCISE}