Skip to content
Merged
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,25 @@ jobs:
echo "$duplicate_uuids"
exit 1
fi

- name: Verify that reimplements-values refer to existing UUID
run: |
fail=0

for f in exercises/*/canonical-data.json; do
# Search for reimplemented test cases
reimplements=$(jq -r '.. |."reimplements"? | select(. != null)' "$f")

# Abort early if the exercise doesn't have reimplemented test cases
[[ -e $reimplements ]] && continue

uuids=$(grep '"uuid":' "$f" | sed -E 's/.*"([^"]+)".*/\1/')
for reimplemented_uuid in $reimplements; do
if [[ $uuids != *"$reimplemented_uuid"* ]]; then
echo "$f: reimplemented value refers to a test case with UUID $reimplemented_uuid, but the file does not contain any test cases with that UUID."
fail=1
Copy link
Member

Choose a reason for hiding this comment

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

Good idea to not immediately bail out.

fi
done
done

exit "$fail"