Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

test(graph): expect a self edge for C recursion through a prototype (#4861)

Swati Ahujaeec2dc26eaa5
diff --git a/tests/unit/ingestion/test_cpp_decl_def.py b/tests/unit/ingestion/test_cpp_decl_def.py
index e542dab70..ab659609d 100644
--- a/tests/unit/ingestion/test_cpp_decl_def.py
+++ b/tests/unit/ingestion/test_cpp_decl_def.py
@@ -158,14 +158,14 @@ class TestCallAttachesToDefinition:
assert _callers_of(graph, "sub-posix.cc::Sub::Finish") == set()
assert _callers_of(graph, "sub-win32.cc::Sub::Finish") == set()
- def test_recursion_through_the_prototype_draws_no_edge(self, tmp_path: Path) -> None:
+ def test_recursion_through_the_prototype_is_a_self_edge(self, tmp_path: Path) -> None:
(tmp_path / "walk.h").write_text("int walk(int n);\n")
(tmp_path / "walk.c").write_text(
'#include "walk.h"\nint walk(int n) { return n ? walk(n - 1) : 0; }\n'
)
graph = _build(tmp_path)
assert _callers_of(graph, "walk.h::walk") == set()
- assert _callers_of(graph, "walk.c::walk") == set()
+ assert _callers_of(graph, "walk.c::walk") == {"walk.c::walk"}
class TestHeaderDefaultsReachTheDefinition: