MCPcopy Create free account
hub / github.com/danielmiessler/Fabric / TestScanFilesSkipsDirectories

Function TestScanFilesSkipsDirectories

cmd/code2context/code_test.go:46–66  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

44}
45
46func TestScanFilesSkipsDirectories(t *testing.T) {
47 tmpDir := t.TempDir()
48
49 file1 := filepath.Join(tmpDir, "test.go")
50 subDir := filepath.Join(tmpDir, "subdir")
51
52 require.NoError(t, os.WriteFile(file1, []byte("package main\n"), 0644))
53 require.NoError(t, os.MkdirAll(subDir, 0755))
54
55 files := []string{file1, subDir}
56
57 jsonData, err := ScanFiles(files, "test")
58 require.NoError(t, err)
59
60 var result []any
61 err = json.Unmarshal(jsonData, &result)
62 require.NoError(t, err)
63
64 report := result[1].(map[string]any)
65 assert.Equal(t, float64(1), report["files"])
66}
67
68func TestScanFilesNonExistentFile(t *testing.T) {
69 files := []string{"/nonexistent/file.go"}

Callers

nothing calls this directly

Calls 1

ScanFilesFunction · 0.85

Tested by

no test coverage detected