MCPcopy Create free account
hub / github.com/diillson/chatcli / TestDetectLanguages

Function TestDetectLanguages

operator/controllers/source_controller_test.go:211–228  ·  view source on GitHub ↗

--- detectLanguages ---

(t *testing.T)

Source from the content-addressed store, hash-verified

209// --- detectLanguages ---
210
211func TestDetectLanguages(t *testing.T) {
212 root := t.TempDir()
213 writeTestFile(t, filepath.Join(root, "main.go"), "package main\n")
214 writeTestFile(t, filepath.Join(root, "util.go"), "package main\n")
215 writeTestFile(t, filepath.Join(root, "script.py"), "print('hi')\n")
216 writeTestFile(t, filepath.Join(root, "vendor", "dep.go"), "package dep\n")
217 writeTestFile(t, filepath.Join(root, ".hidden", "x.go"), "package x\n")
218
219 langs := detectLanguages(root)
220 if len(langs) != 2 {
221 t.Fatalf("expected 2 languages, got %v", langs)
222 }
223 // Go has 2 files vs Python's 1 (vendor/ and .hidden/ are skipped),
224 // so Go must sort first.
225 if langs[0] != "Go" || langs[1] != "Python" {
226 t.Errorf("expected [Go Python], got %v", langs)
227 }
228}
229
230// --- extractRelevantCode ---
231

Callers

nothing calls this directly

Calls 3

detectLanguagesFunction · 0.85
ErrorfMethod · 0.80
writeTestFileFunction · 0.70

Tested by

no test coverage detected