MCPcopy Index your code
hub / github.com/cheat/cheat / TestFindLocalCheatpathInCurrentDir

Function TestFindLocalCheatpathInCurrentDir

internal/config/config_test.go:18–34  ·  view source on GitHub ↗

TestFindLocalCheatpathInCurrentDir tests that .cheat in the given dir is found

(t *testing.T)

Source from the content-addressed store, hash-verified

16
17// TestFindLocalCheatpathInCurrentDir tests that .cheat in the given dir is found
18func TestFindLocalCheatpathInCurrentDir(t *testing.T) {
19 tempDir, err := os.MkdirTemp("", "cheat-test-*")
20 if err != nil {
21 t.Fatalf("failed to create temp dir: %v", err)
22 }
23 defer os.RemoveAll(tempDir)
24
25 cheatDir := filepath.Join(tempDir, ".cheat")
26 if err := os.Mkdir(cheatDir, 0755); err != nil {
27 t.Fatalf("failed to create .cheat dir: %v", err)
28 }
29
30 result := findLocalCheatpath(tempDir)
31 if result != cheatDir {
32 t.Errorf("expected %s, got %s", cheatDir, result)
33 }
34}
35
36// TestFindLocalCheatpathInParent tests walking up to a parent directory
37func TestFindLocalCheatpathInParent(t *testing.T) {

Callers

nothing calls this directly

Calls 1

findLocalCheatpathFunction · 0.85

Tested by

no test coverage detected