Skip to content

Commit

Permalink
fix: improve error handling to catch syntax errors (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkweon authored Nov 22, 2024
1 parent ca8a7fd commit 5dd4784
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions bin/verify-exercises.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ do
exercise=$(basename "${example_file}" .example.pl)
echo '-------------------------------------------------------'
echo "Testing ${exercise}"
swipl -f "${example_dir}/${exercise}.example.pl" -s "${exercise_dir}/${exercise}_tests.plt" -g run_tests,halt -t 'halt(1)' -- --all
if [ $? -ne 0 ]; then
if ! swipl -f "${example_file}" \
-s "${exercise_dir}/${exercise}_tests.plt" \
-g run_tests,halt \
-t 'halt(1)' \
--on-error=status \
-- --all; then
TEST_RESULT=1
FAILED_EXERCISES+="${exercise}\n"
FAILED_EXERCISES+="${example_file}\n"
fi
done

if [ "${TEST_RESULT}" -ne 0 ]; then
echo "The following exercises failed"
printf "${FAILED_EXERCISES}"
echo "The following exercises failed:"
printf "%b" "${FAILED_EXERCISES}"
exit "${TEST_RESULT}"
fi

0 comments on commit 5dd4784

Please sign in to comment.