From 9ed61c9879ac9384be6f7ceda5c05087b1e02507 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 14 Nov 2026 17:30:54 +0000 Subject: [PATCH] test: scan src/ recursively for Agda citations The citation extractor in scripts/check-agda-citations.sh globbed only src/*.jl, and the offline testset only read the immediate entries of src/. A citation in a file under a subdirectory (src/foo/bar.jl) would be missed by both, so the fixture could omit it and both checks still pass (found by the Codex review of #36). Use find and walkdir so every .jl file under src/ is scanned. src/ has no subdirectories today, so the fixture is unchanged: verify passes for the 62 names and Pkg.test() passes (306). Negative control: an unlisted citation in src/nested/control.jl now fails both the script (exit 1) and the testset (1 failure). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0136P7ZnB2Fzqf8br8DGDD4k --- scripts/check-agda-citations.sh | 4 ++-- test/runtests.jl | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/check-agda-citations.sh b/scripts/check-agda-citations.sh index d611b90..7335e63 100755 --- a/scripts/check-agda-citations.sh +++ b/scripts/check-agda-citations.sh @@ -11,7 +11,7 @@ # # Usage: # scripts/check-agda-citations.sh extract -# Print the cited names found in src/, one per line, sorted. +# Print the cited names found in src/ (all subdirectories), one per line, sorted. # scripts/check-agda-citations.sh verify # Check that the fixture matches src/, and that every name in it is # declared in an .agda file of the checkout. Exit 0 when both hold, @@ -26,7 +26,7 @@ ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) FIXTURE="$ROOT/test/agda-citations.txt" extract() { - grep -ohE '`[A-Za-z][A-Za-z0-9]*(-[A-Za-z0-9]+)+`' "$ROOT"/src/*.jl \ + find "$ROOT/src" -type f -name '*.jl' -exec grep -ohE '`[A-Za-z][A-Za-z0-9]*(-[A-Za-z0-9]+)+`' {} + \ | tr -d '`' | LC_ALL=C sort -u } diff --git a/test/runtests.jl b/test/runtests.jl index ccf18f0..5c2f204 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -546,9 +546,9 @@ using Test cite = r"`([A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)+)`" srcdir = joinpath(@__DIR__, "..", "src") cited = Set{String}() - for f in readdir(srcdir; join = true) - endswith(f, ".jl") || continue - for m in eachmatch(cite, read(f, String)) + for (root, _, files) in walkdir(srcdir), name in files + endswith(name, ".jl") || continue + for m in eachmatch(cite, read(joinpath(root, name), String)) push!(cited, m.captures[1]) end end