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

Function TestScanFilesExtensions

scanner/walker_test.go:107–141  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

105}
106
107func TestScanFilesExtensions(t *testing.T) {
108 tmpDir := t.TempDir()
109
110 testFiles := map[string]string{
111 "main.go": ".go",
112 "app.py": ".py",
113 "index.js": ".js",
114 "style.css": ".css",
115 "Makefile": "",
116 "README": "",
117 "config.json": ".json",
118 }
119
120 for name := range testFiles {
121 if err := os.WriteFile(filepath.Join(tmpDir, name), []byte("content"), 0644); err != nil {
122 t.Fatal(err)
123 }
124 }
125
126 result, err := ScanFiles(tmpDir, nil, nil, nil)
127 if err != nil {
128 t.Fatal(err)
129 }
130
131 extMap := make(map[string]string)
132 for _, f := range result {
133 extMap[filepath.Base(f.Path)] = f.Ext
134 }
135
136 for name, expectedExt := range testFiles {
137 if got := extMap[name]; got != expectedExt {
138 t.Errorf("File %s: expected ext %q, got %q", name, expectedExt, got)
139 }
140 }
141}
142
143func TestFilterToChanged(t *testing.T) {
144 files := []FileInfo{

Callers

nothing calls this directly

Calls 1

ScanFilesFunction · 0.85

Tested by

no test coverage detected