-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_analysis.lua
More file actions
55 lines (46 loc) · 1.36 KB
/
test_analysis.lua
File metadata and controls
55 lines (46 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env luajit
-- Test the full analysis pipeline against the test project
-- Add lua/ to path
package.path = "./lua/?.lua;" .. package.path
local cjson = require("cjson")
local analyzer = require("analyzer")
local root = "./test-project"
print("=== Analyzing test project: " .. root .. " ===\n")
local ok, result = pcall(analyzer.analyze, root)
if not ok then
print("ERROR: " .. tostring(result))
os.exit(1)
end
-- Pretty-print summary
print("Files: " .. #result.files)
for _, f in ipairs(result.files) do
print(" " .. f)
end
print("\nFunctions (" .. #result.nodes .. "):")
for _, node in ipairs(result.nodes) do
print(string.format(" [%s] %s (%s:%d) %s%s",
node.kind,
node.name,
node.file_path,
node.line,
node.is_exported and "exported " or "",
node.is_async and "async" or ""
))
if #node.params > 0 then
print(" params: " .. table.concat(node.params, ", "))
end
end
print("\nCall Edges (" .. #result.edges .. "):")
for _, edge in ipairs(result.edges) do
print(string.format(" %s → %s (line %d, order %d%s%s)",
edge.source,
edge.target,
edge.line,
edge.order,
edge.is_conditional and ", conditional" or "",
edge.is_in_loop and ", in loop" or ""
))
end
-- Output full JSON
print("\n=== Full JSON ===")
print(cjson.encode(result))