aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-ai/render-tests.sh
blob: 8dedc76e32cdca9bd1bef46e0b4c691e91725505 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Render all test cases from test-renders.json
# Usage: ./render-tests.sh [test_name]
#   With no args: renders all tests
#   With arg: renders only matching test (e.g., ./render-tests.sh 05)

set -e
cd "$(dirname "$0")"

JSON_FILE="test-renders.json"
FILTER="${1:-}"

# Build once
cargo build -p atuin-ai --quiet

# Count tests
TOTAL=$(jq length "$JSON_FILE")

for i in $(seq 0 $((TOTAL - 1))); do
    NAME=$(jq -r ".[$i].name" "$JSON_FILE")
    DESC=$(jq -r ".[$i].description" "$JSON_FILE")
    STATE=$(jq -c ".[$i].state" "$JSON_FILE")

    # Skip if filter provided and doesn't match
    if [[ -n "$FILTER" && ! "$NAME" =~ $FILTER ]]; then
        continue
    fi

    echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
    echo "[$NAME] $DESC"
    echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
    echo "$STATE" | cargo run -p atuin-ai --quiet -- debug-render -f plain
    echo ""
done