#!/bin/bash
# Pre-push hook: Run tests

set -e

echo "Running pre-push checks..."

# Check if cargo is installed
if ! command -v cargo &> /dev/null; then
    echo "Error: cargo not found. Please install Rust."
    exit 1
fi

# Run tests
echo "Running tests..."
if ! cargo test; then
    echo ""
    echo "Error: Tests failed."
    echo "Fix the failing tests before pushing."
    exit 1
fi

echo "Pre-push checks passed!"
