Skip to content

Commit

Permalink
test(fixtures): Ease testing just one fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaelatern committed Dec 5, 2024
1 parent db3ceec commit b002da8
Showing 1 changed file with 20 additions and 11 deletions.
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 "$@"

0 comments on commit b002da8

Please sign in to comment.