#!/usr/bin/env bash

ERROR=0

while IFS= read -r -d '' f; do
  echo "run 'cargo test' with ${f}"
  cargo test --manifest-path="${f}"

  if [[ $? -ne 0 ]]; then
    ERROR=1
  fi
done < <(find . -type f -name 'Cargo.toml' -print0)

exit ${ERROR}
