Files
llm-intelligence/scripts/review/backlog_current_table_guard_test.sh
2026-05-29 18:48:48 +08:00

39 lines
1.3 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$ROOT_DIR"
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
BAD_FILE="$TMP_DIR/bad-backlog.md"
cat > "$BAD_FILE" <<'EOF'
## 当前未修复问题速查表(截至 2026-05-29 12:00
| # | 问题 | 优先级 | 首次暴露 | 修复状态 | 影响次数 |
|---|------|--------|----------|----------|----------|
| 1 | old resolved item | P1 | 05-01 10:00 | ✅ 已修复 | 1 次 |
| 2 | still open | P1 | 05-01 11:00 | ❌ 未修复 | 2 次 |
---
EOF
set +e
bash scripts/review/backlog_current_table_guard.sh "$BAD_FILE" >/tmp/backlog_guard_bad.out 2>&1
BAD_RC=$?
set -e
[[ "$BAD_RC" -ne 0 ]]
grep -q 'resolved rows still present in current table' /tmp/backlog_guard_bad.out
GOOD_FILE="$TMP_DIR/good-backlog.md"
cat > "$GOOD_FILE" <<'EOF'
## 当前未修复问题速查表(截至 2026-05-29 12:00
| # | 问题 | 优先级 | 首次暴露 | 修复状态 | 影响次数 |
|---|------|--------|----------|----------|----------|
| 2 | still open | P1 | 05-01 11:00 | ❌ 未修复 | 2 次 |
| 3 | partial item | P1 | 05-01 12:00 | ⚠️ 部分 | 3 次 |
---
EOF
bash scripts/review/backlog_current_table_guard.sh "$GOOD_FILE" >/tmp/backlog_guard_good.out 2>&1
grep -q 'BACKLOG_CURRENT_TABLE rows=2 resolved_rows=0' /tmp/backlog_guard_good.out