MCPcopy
hub / github.com/cheat/cheat / TestFindLocalCheatpathSkipsFile

Function TestFindLocalCheatpathSkipsFile

internal/config/config_test.go:134–151  ·  view source on GitHub ↗

TestFindLocalCheatpathSkipsFile tests that a file named .cheat is not matched

(t *testing.T)

Source from the content-addressed store, hash-verified

132
133// TestFindLocalCheatpathSkipsFile tests that a file named .cheat is not matched
134func TestFindLocalCheatpathSkipsFile(t *testing.T) {
135 tempDir, err := os.MkdirTemp("", "cheat-test-*")
136 if err != nil {
137 t.Fatalf("failed to create temp dir: %v", err)
138 }
139 defer os.RemoveAll(tempDir)
140
141 // Create .cheat as a file, not a directory
142 cheatFile := filepath.Join(tempDir, ".cheat")
143 if err := os.WriteFile(cheatFile, []byte("not a directory"), 0644); err != nil {
144 t.Fatalf("failed to create .cheat file: %v", err)
145 }
146
147 result := findLocalCheatpath(tempDir)
148 if result != "" {
149 t.Errorf("expected empty string for .cheat file, got %s", result)
150 }
151}
152
153// TestFindLocalCheatpathSymlink tests that a .cheat symlink to a directory is found
154func TestFindLocalCheatpathSymlink(t *testing.T) {

Callers

nothing calls this directly

Calls 1

findLocalCheatpathFunction · 0.85

Tested by

no test coverage detected