#!/usr/bin/env bash
set -euo pipefail

# Run LLVM coverage with HTML output
cargo llvm-cov \
  --html \
  --ignore-filename-regex="(_test\.rs|fixtures\.rs|bindings)"

# Open the coverage report (macOS)
if [[ "$OSTYPE" == "darwin"* ]]; then
  open target/llvm-cov/html/index.html
elif command -v xdg-open >/dev/null 2>&1; then
  xdg-open target/llvm-cov/html/index.html
else
  echo "Coverage report generated at:"
  echo "  target/llvm-cov/html/index.html"
fi
