Skip to content

Commit e14f500

Browse files
committed
test: add unit tests for P1-P5 paper integration modules
Add 134 unit tests covering the new modules introduced by the LLM-paper integration tracks: - agent_scaffold_tests.rs (17 tests): CallGraphBuilder, FunctionLookup, call-graph path sampling for C and Python - agent_flow_tests.rs (35 tests): TypeError Display, typecheck, diagnoser, DSL harness construction, apply_rewrite - context_pacvd_tests.rs (53 tests): AbstractionLevel, extract, auto_level, 4-dimensional abstraction vectors - rulesynth_validator_tests.rs (35 tests): validate, format_feedback, load_corpus, emit_yaml, Pattern construction Fix two production bugs discovered by the C tests: get_function_name in both fn_lookup.rs and call_graph_paths.rs did not recognise tree-sitter-c's function_declarator node kind, so C functions were never indexed. Add 'function_declarator' to the matched child kinds. CI gate: fmt OK, clippy clean, 2944 tests pass (+134).
1 parent 96c8a7d commit e14f500

7 files changed

Lines changed: 2184 additions & 2 deletions

File tree

src/agent_scaffold/call_graph_paths.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,10 @@ fn get_function_name(node: &tree_sitter::Node, source: &[u8]) -> Option<String>
277277
}
278278

279279
// Python/Rust function_definition with name child
280-
if child_kind == "function_definition" || child_kind == "declarator" {
280+
if child_kind == "function_definition"
281+
|| child_kind == "declarator"
282+
|| child_kind == "function_declarator"
283+
{
281284
for name_child in child.children(&mut child.walk()) {
282285
if name_child.kind() == "identifier" {
283286
return name_child.utf8_text(source).ok().map(|s| s.to_string());

src/agent_scaffold/fn_lookup.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,10 @@ fn get_function_name(node: &tree_sitter::Node, source: &[u8]) -> Option<String>
229229
}
230230

231231
// Python/Rust function_definition with name child
232-
if child_kind == "function_definition" || child_kind == "declarator" {
232+
if child_kind == "function_definition"
233+
|| child_kind == "declarator"
234+
|| child_kind == "function_declarator"
235+
{
233236
for name_child in child.children(&mut child.walk()) {
234237
if name_child.kind() == "identifier" {
235238
return name_child.utf8_text(source).ok().map(|s| s.to_string());

0 commit comments

Comments
 (0)