Skip to content

verify tool working. test.sno changed to suit.#38

Merged
axtens merged 2 commits into
exercism:mainfrom
axtens:verifier
Mar 10, 2026
Merged

verify tool working. test.sno changed to suit.#38
axtens merged 2 commits into
exercism:mainfrom
axtens:verifier

Conversation

@axtens

@axtens axtens commented Mar 10, 2026

Copy link
Copy Markdown
Member

No description provided.

@github-actions

Copy link
Copy Markdown

This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested.

If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos.

[no important files changed]

For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping @exercism/maintainers-admin in a comment. Thank you!

@axtens axtens merged commit 4269dd6 into exercism:main Mar 10, 2026
1 check passed
@axtens axtens deleted the verifier branch March 10, 2026 14:21
Comment thread bin/verify-exercises
echo "Checking $(basename "${practice_exercise_dir}") exercise..."
# TODO: run command to verify that the example solution passes the tests
for dir in ./exercises/practice/*/; do
if [ -d $dir ]; then

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
if [ -d $dir ]; then
if [[ -d $dir ]]; then

If you negate this test, you can unnest the rest of the block.
If you set -o nullglob first, this test shouldn't be needed as this loop will only run with a directory path.

Comment thread bin/verify-exercises
# TODO: run command to verify that the example solution passes the tests
for dir in ./exercises/practice/*/; do
if [ -d $dir ]; then
slug=$(basename "${dir}")

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
slug=$(basename "${dir}")
slug="${dir##*/}"

Comment thread bin/verify-exercises
for dir in ./exercises/practice/*/; do
if [ -d $dir ]; then
slug=$(basename "${dir}")
echo $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.

Unquoted expansion. You could also make this a bit more informative.

Suggested change
echo $slug
printf 'Testing practice exercise %\n' "$slug"

Comment thread bin/verify-exercises
if [ -d $dir ]; then
slug=$(basename "${dir}")
echo $slug
cd "${dir}"

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
cd "${dir}"
cd "${dir}" || exit

Comment thread bin/verify-exercises
slug=$(basename "${dir}")
echo $slug
cd "${dir}"
mv "${slug}.sno" "${slug}.aside"

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.

Consider using a tempdir for temp files.

Comment thread bin/verify-exercises
cp ".meta/example.sno" "${slug}.sno"
snobol4 test.sno
errcode=$?
mv "${slug}.aside" "${slug}.sno"

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.

You could use a subshell to handle the undo-cd and a trap to handle this cleanup. That would tidy things up.

You can also report on all the failing tests vs the first failure.

tmpdir=$(mktemp -d)
set -o nullglob
failed=()
for dir in ./exercises/practice/*/; do
    slug="${dir##*/}"
    (
        cd "$slug" || exit
        cleanup () { mv "$tmpdir/$slug.sno" ./; }
        trap cleanup EXIT
        mv "$slug.sno" "$tmpdir"
        cp ".meta/example.sno" "$slug.sno"
        snobol4 test.sno
    ) || failed+=("$slug")
done

if (( ${#failed[@]}" )); then
    echo "Some practice tests failed:"
    printf '* %s\n' "${failed[@]}"
    exit 1
fi

Comment thread bin/verify-exercises
errcode=$?
mv "${slug}.aside" "${slug}.sno"
cd - > /dev/null
if [ $errcode -ne 0 ]; then

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
if [ $errcode -ne 0 ]; then
if (( errcode != 0 )); then

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