TestFindLocalCheatpathSkipsFile tests that a file named .cheat is not matched
(t *testing.T)
| 132 | |
| 133 | // TestFindLocalCheatpathSkipsFile tests that a file named .cheat is not matched |
| 134 | func 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 |
| 154 | func TestFindLocalCheatpathSymlink(t *testing.T) { |
nothing calls this directly
no test coverage detected