aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mkhint_test.sh
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-06-19 10:26:22 +0200
committerDanilo M. <danix@danix.xyz>2026-06-19 10:26:22 +0200
commite9730f8eaed88cc742e6db34786b19bb712b5866 (patch)
tree82a0756ff1f6c131a5c68a9c04a9836c98f28115 /tests/mkhint_test.sh
parentf2f19227b14d5a342fdfb48f7d67914d947160a9 (diff)
downloadmkhintfile-e9730f8eaed88cc742e6db34786b19bb712b5866.tar.gz
mkhintfile-e9730f8eaed88cc742e6db34786b19bb712b5866.zip
perf: scan single nvchecker entry with -e for single-package checksHEADmaster
When --check is given exactly one package, and when --hintfile suggests a version without -v, run `nvchecker -e <pkg>` so only that entry is scanned instead of the whole nvchecker.toml. Two+ packages or no args still do one full scan, since nvchecker -e accepts only a single entry. Add T42/T43 (mock nvchecker now logs its args), and update CLAUDE.md and README.md (including the previously undocumented -R/--review and -l highlight). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'tests/mkhint_test.sh')
-rwxr-xr-xtests/mkhint_test.sh37
1 files changed, 35 insertions, 2 deletions
diff --git a/tests/mkhint_test.sh b/tests/mkhint_test.sh
index e95b529..4ee3059 100755
--- a/tests/mkhint_test.sh
+++ b/tests/mkhint_test.sh
@@ -163,9 +163,10 @@ EOF
mock_nvchecker_tools() {
mkdir -p "$MOCK_BASE/bin"
- # nvchecker: no-op success (keyfile is pre-seeded by setup/tests)
- cat > "$MOCK_BASE/bin/nvchecker" << 'EOF'
+ # nvchecker: record invocations, no-op success (keyfile pre-seeded by setup/tests)
+ cat > "$MOCK_BASE/bin/nvchecker" << EOF
#!/bin/bash
+echo "nvchecker \$*" >> "$MOCK_BASE/nvchecker.log"
exit 0
EOF
chmod +x "$MOCK_BASE/bin/nvchecker"
@@ -838,6 +839,38 @@ echo "$out" | grep -q "nothing to review" \
&& { echo " PASS: nothing-to-review message"; (( PASS++ )); } \
|| { echo " FAIL: message missing"; echo "$out" | sed 's/^/ /'; (( FAIL++ )); ERRORS+=("T41 msg"); }
+# ── T42: --check single package → nvchecker called with -e <pkg> ──────────────
+echo ""
+echo "T42: --check one package runs nvchecker -e <pkg>"
+rm -f "$MOCK_HINT"/*.hint "$MOCK_HINT"/*.bak "$MOCK_BASE/nvchecker.log" 2>/dev/null
+cat > "$MOCK_BASE/new_ver.json" << 'EOF'
+{ "version": 2, "data": { "curl": { "version": "8.5.0" } } }
+EOF
+cat > "$MOCK_HINT/curl.hint" << 'EOF'
+VERSION="8.5.0"
+ARCH="x86_64"
+DOWNLOAD="https://curl.se/download/curl-8.5.0.tar.gz"
+MD5SUM="abc123def456abc123def456abc123de"
+EOF
+run_mkhint -C curl < <(printf '\n') > /dev/null 2>&1
+assert_contains "nvchecker run with -e curl" "$MOCK_BASE/nvchecker.log" '\-e curl'
+
+# ── T43: --check two packages → nvchecker scans all (no -e) ───────────────────
+echo ""
+echo "T43: --check two packages runs nvchecker without -e (full scan)"
+rm -f "$MOCK_BASE/nvchecker.log" 2>/dev/null
+cat > "$MOCK_BASE/new_ver.json" << 'EOF'
+{ "version": 2, "data": { "curl": { "version": "8.5.0" }, "clion": { "version": "2025.4" } } }
+EOF
+cat > "$MOCK_HINT/clion.hint" << 'EOF'
+VERSION="2025.4"
+ARCH="x86_64"
+DOWNLOAD="UNSUPPORTED"
+MD5SUM=""
+EOF
+run_mkhint -C curl clion < <(printf '\n') > /dev/null 2>&1
+assert_not_contains "two-pkg check has no -e" "$MOCK_BASE/nvchecker.log" '\-e '
+
# ─── SUMMARY ──────────────────────────────────────────────────────────────────
teardown