aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mkhint_test.sh
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-06-13 18:33:34 +0200
committerDanilo M. <danix@danix.xyz>2026-06-13 18:33:34 +0200
commit8e6531764b00b29259fc59bd4e1f16e019bc3f2a (patch)
tree1f8bc043687aa3e8fa079f95deee5a5e15036d79 /tests/mkhint_test.sh
parent1be322b71ef7ff19cff6e35551c1a1cc240ca52d (diff)
downloadmkhintfile-8e6531764b00b29259fc59bd4e1f16e019bc3f2a.tar.gz
mkhintfile-8e6531764b00b29259fc59bd4e1f16e019bc3f2a.zip
fix: resolve relative nvchecker keyfile path against config dir
nvchecker resolves a relative oldver/newver/keyfile path against the config file's directory, not the CWD. _nvchecker_newver_path returned the raw relative string (e.g. "new_ver.json"), so nvchecker_latest's [[ -f ]] check ran against whatever CWD 'mkhint -C' was launched from — almost never the config dir. Result: every package reported 'no nvchecker result' and the run said 'all up to date' despite nvchecker having found updates. Resolve non-absolute keyfile paths against dirname(NVCHECKER_CONFIG). T35 covers a relative newver path with the keyfile beside the config. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'tests/mkhint_test.sh')
-rwxr-xr-xtests/mkhint_test.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/mkhint_test.sh b/tests/mkhint_test.sh
index 2a17f32..dd88c05 100755
--- a/tests/mkhint_test.sh
+++ b/tests/mkhint_test.sh
@@ -718,6 +718,32 @@ echo "$out" | grep -q "yt-dlp: no nvchecker section" \
&& { echo " FAIL: quoted section wrongly flagged missing"; (( FAIL++ )); ERRORS+=("T34 false missing"); } \
|| { echo " PASS: not flagged as missing section"; (( PASS++ )); }
+# ── T35: relative newver path resolved against config dir, not CWD ─────────────
+echo ""
+echo "T35: relative newver path in config → resolved against config dir"
+# config uses a RELATIVE newver path (as nvchecker writes by default).
+# keyfile lives beside the config in $MOCK_BASE. The run happens with CWD
+# elsewhere (the repo dir), so a CWD-relative read would fail to find it.
+cat > "$MOCK_BASE/nvchecker.toml" << EOF
+[__config__]
+oldver = "old_ver.json"
+newver = "new_ver.json"
+EOF
+cat > "$MOCK_BASE/new_ver.json" << 'EOF'
+{ "version": 2, "data": { "curl": { "version": "8.9.0" } } }
+EOF
+rm -f "$MOCK_HINT"/*.hint "$MOCK_HINT"/*.bak 2>/dev/null
+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"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+EOF
+run_mkhint -C curl < <(printf 'Y\nn\n')
+assert_contains "relative-path keyfile found → curl updated" "$MOCK_HINT/curl.hint" 'VERSION="8.9.0"'
+
# ─── SUMMARY ──────────────────────────────────────────────────────────────────
teardown