Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(fixtures): Ease testing just one fixture #374

Merged
merged 3 commits into from
Dec 7, 2024
Merged
Changes from 1 commit
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
31 changes: 20 additions & 11 deletions fixtures/test-fixtures.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,29 @@ run_fixture() {
return "$result"
}

proc_fixture() {
# Since we are creating a subshell, all environment variables created by custom_env will be lost
# Return code is preserved
fixture="$1"
(run_fixture "$fixture")
exit_status=$?
if [ "$exit_status" -eq 0 ]; then
echo -e "[${GREEN}ok${NC}] $fixture"
else
echo -e "[${RED}fail${NC}] $fixture"
exit "$exit_status"
fi
}

main() {
[ $# -ne 0 ] && for fixture in "$@"; do
proc_fixture "$fixture"
done && exit 0

find * -maxdepth 0 -type d -print0 | while IFS= read -r -d '' fixture; do
# Since we are creating a subshell, all environment variables created by custom_env will be lost
# Return code is preserved
(run_fixture "$fixture")
exit_status=$?
if [ "$exit_status" -eq 0 ]; then
echo -e "[${GREEN}ok${NC}] $fixture"
else
echo -e "[${RED}fail${NC}] $fixture"
exit "$exit_status"
fi
proc_fixture "$fixture"
done
}

[ "$DEBUG" == 'true' ] && set -x && export RUST_LOG=debug
main
main "$@"