MCPcopy Create free account
hub / github.com/JordanCoin/codemap / TestAstGrepScanner

Function TestAstGrepScanner

scanner/bench_test.go:40–73  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

38}
39
40func TestAstGrepScanner(t *testing.T) {
41 scanner, err := NewAstGrepScanner()
42 if err != nil {
43 t.Fatalf("Failed to create scanner: %v", err)
44 }
45 defer scanner.Close()
46
47 if !scanner.Available() {
48 t.Skip("sg not available")
49 }
50
51 // Test on codemap's own codebase
52 results, err := scanner.ScanDirectory("..")
53 if err != nil {
54 t.Fatalf("ScanDirectory failed: %v", err)
55 }
56
57 if len(results) == 0 {
58 t.Error("Expected some results")
59 }
60
61 var totalFuncs, totalImports int
62 for _, r := range results {
63 totalFuncs += len(r.Functions)
64 totalImports += len(r.Imports)
65 }
66
67 t.Logf("Scanned %d files, found %d functions and %d imports", len(results), totalFuncs, totalImports)
68
69 // Should find some Go functions
70 if totalFuncs == 0 {
71 t.Error("Expected to find some functions")
72 }
73}

Callers

nothing calls this directly

Calls 5

CloseMethod · 0.95
AvailableMethod · 0.95
ScanDirectoryMethod · 0.95
NewAstGrepScannerFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected