TestFindLocalCheatpathInCurrentDir tests that .cheat in the given dir is found
(t *testing.T)
| 16 | |
| 17 | // TestFindLocalCheatpathInCurrentDir tests that .cheat in the given dir is found |
| 18 | func 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 |
| 37 | func TestFindLocalCheatpathInParent(t *testing.T) { |
nothing calls this directly
no test coverage detected