Skip to content

Add verify-exercises-in-docker script#361

Merged
keiravillekode merged 2 commits intoexercism:mainfrom
keiravillekode:verify-exercises-in-docker
Apr 13, 2026
Merged

Add verify-exercises-in-docker script#361
keiravillekode merged 2 commits intoexercism:mainfrom
keiravillekode:verify-exercises-in-docker

Conversation

@keiravillekode
Copy link
Copy Markdown
Contributor

This useful script from generic-track tests exercise(s) against the test runner.

Like bin/test-exercise,
we splice the exercise's example solution with the unittest block from the source.

@github-actions
Copy link
Copy Markdown
Contributor

Hello 👋 Thanks for your PR.

This repo does not currently have dedicated maintainers. Our cross-track maintainers team will attempt to review and merge your PR, but it will likely take longer for your PR to be reviewed.

If you enjoy contributing to Exercism and have a track-record of doing so successfully, you might like to become an Exercism maintainer for this track.

Please feel free to ask any questions, or chat to us about anything to do with this PR or the reviewing process on the Exercism forum.

(cc @exercism/cross-track-maintainers)

Comment thread bin/verify-exercises-in-docker Outdated
Comment thread bin/verify-exercises-in-docker Outdated
Comment thread bin/verify-exercises-in-docker Outdated
cd "${tmp_dir}"

splice_example_with_tests
run_tests "${slug}" || { cat "${PWD}/results.json"; exit 1; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer return to exit where viable

Comment thread bin/verify-exercises-in-docker Outdated
Comment on lines +88 to +95
count=0
for exercise_dir in ./exercises/{concept,practice}/${exercise_slug}/; do
if [[ -d "${exercise_dir}" ]]; then
verify_exercise "${exercise_dir}"
((++count))
fi
done
((count > 0)) || die 'no matching exercises found!'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
count=0
for exercise_dir in ./exercises/{concept,practice}/${exercise_slug}/; do
if [[ -d "${exercise_dir}" ]]; then
verify_exercise "${exercise_dir}"
((++count))
fi
done
((count > 0)) || die 'no matching exercises found!'
exercises=(./exercises/{concept,practice}/${exercise_slug}/)
(( "${#exercises[@]}" == 0 )) && die 'no matching exercises found!'
for exercise_dir in "${exercises[@]}"; do
verify_exercise "${exercise_dir}"
done

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have kept the count variable.

We want to report 'no matching exercises found!' when the user mistypes an exercise slug.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW I used this file as a base to build a Go verify-in-docker script: https://github.com/IsaacG/fork-exercism-go/blob/main/bin/verify-exercises-in-docker
Feel free to copy anything you like in there :)

Comment thread bin/verify-exercises-in-docker Outdated
Comment thread bin/verify-exercises-in-docker Outdated
@keiravillekode keiravillekode force-pushed the verify-exercises-in-docker branch from 2dba53c to 45d4fcd Compare April 13, 2026 00:22
@keiravillekode keiravillekode merged commit 73e0b63 into exercism:main Apr 13, 2026
5 checks passed
@keiravillekode keiravillekode deleted the verify-exercises-in-docker branch April 13, 2026 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants