WIP: Phase 6 review
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
sys.path.append(str(Path(__file__).parent.parent))
|
||||
|
||||
from src.mcp_client import ts_cpp_get_definition, ts_cpp_get_signature, ts_cpp_get_code_outline
|
||||
from src.aggregate import build_tier3_context
|
||||
|
||||
def test_ast_masking_gencpp_samples():
|
||||
ast_hpp = "tests/assets/gencpp_samples/ast.hpp"
|
||||
|
||||
# 1. Verify we can get a complex definition despite forward declarations
|
||||
# Currently it might return the forward declaration, let's check
|
||||
defn = ts_cpp_get_definition(ast_hpp, "AST")
|
||||
print(f"--- AST Definition (len {len(defn)}) ---")
|
||||
print(defn[:100] + "...")
|
||||
|
||||
# 2. Test Masking logic in aggregation
|
||||
item = {
|
||||
"path": Path(ast_hpp),
|
||||
"entry": ast_hpp,
|
||||
"content": Path(ast_hpp).read_text(encoding="utf-8"),
|
||||
"ast_mask": {"AST": "def", "Code::append": "sig"},
|
||||
"auto_aggregate": True,
|
||||
"force_full": False,
|
||||
"tier": None
|
||||
}
|
||||
|
||||
res = build_tier3_context([item], Path("."), [], [], [])
|
||||
print("--- MASKED AGGREGATION RESULT ---")
|
||||
# Search for Code::append signature in result
|
||||
if "forceinline void append(Code other)" in res:
|
||||
print("SUCCESS: Code::append signature found!")
|
||||
else:
|
||||
print("FAILURE: Code::append signature NOT found!")
|
||||
# Print a bit of what IS there
|
||||
print(res[2800:3500])
|
||||
|
||||
assert "(Masked)" in res
|
||||
assert "struct AST" in res
|
||||
assert "forceinline void append(Code other)" in res
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_ast_masking_gencpp_samples()
|
||||
Reference in New Issue
Block a user