summaryrefslogtreecommitdiffstats
path: root/tests/mkhint_test.sh
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-07-04 09:29:44 +0200
committerDanilo M. <danix@danix.xyz>2026-07-04 09:29:44 +0200
commitd898f624bd3b03c99c1e889c1fb7e8fd68f033cf (patch)
tree11b6b874e24c6e6326eafc36302d7c0bab81254a /tests/mkhint_test.sh
parent11d1c51b97ae830b591c51b874da01de90a083dc (diff)
downloadmkhintfile-d898f624bd3b03c99c1e889c1fb7e8fd68f033cf.tar.gz
mkhintfile-d898f624bd3b03c99c1e889c1fb7e8fd68f033cf.zip
feat: -l <pkg...> shows side-by-side hint vs .info
With package names, --list skips the table and shows each named hint diffed against its .info (git diff --no-index, else diff -y), missing hint exits 2. Diff display extracted to _show_hint_diff, shared with --review. Bash completion completes hint names after -l. Adds T58, T59. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'tests/mkhint_test.sh')
-rwxr-xr-xtests/mkhint_test.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/mkhint_test.sh b/tests/mkhint_test.sh
index 425eba2..974441c 100755
--- a/tests/mkhint_test.sh
+++ b/tests/mkhint_test.sh
@@ -1122,6 +1122,31 @@ echo "$out" | grep -q "Total: 1 file" \
&& { echo " PASS: count excludes versionless"; (( PASS++ )); } \
|| { echo " FAIL: count wrong"; (( FAIL++ )); ERRORS+=("T57 count"); }
+# ── T58: -l <pkg> shows side-by-side diff, not the table ─────────────────────
+echo ""
+echo "T58: -l <pkg> shows hint vs .info diff"
+rm -f "$MOCK_HINT"/*.hint "$MOCK_HINT"/*.bak 2>/dev/null
+cat > "$MOCK_HINT/curl.hint" << 'EOF'
+VERSION="8.5.0"
+ARCH="x86_64"
+EOF
+out=$(run_mkhint -l curl 2>&1)
+echo "$out" | grep -q "=== curl ===" \
+ && { echo " PASS: diff header shown"; (( PASS++ )); } \
+ || { echo " FAIL: diff header missing"; (( FAIL++ )); ERRORS+=("T58 header"); }
+echo "$out" | grep -q "HintVer" \
+ && { echo " FAIL: table printed"; (( FAIL++ )); ERRORS+=("T58 table"); } \
+ || { echo " PASS: no table"; (( PASS++ )); }
+
+# ── T59: -l <missing> → exit 2 ───────────────────────────────────────────────
+echo ""
+echo "T59: -l on nonexistent hint → exit 2"
+set +e
+run_mkhint -l nope 2>/dev/null
+code=$?
+set -e
+assert_exit_code "missing hint" 2 "$code"
+
# ─── SUMMARY ──────────────────────────────────────────────────────────────────
teardown