(t *testing.T)
| 34 | } |
| 35 | |
| 36 | func TestCanonicalPathResolvesSymlink(t *testing.T) { |
| 37 | realDir := t.TempDir() |
| 38 | linkParent := t.TempDir() |
| 39 | linkPath := filepath.Join(linkParent, "repo-link") |
| 40 | if err := os.Symlink(realDir, linkPath); err != nil { |
| 41 | t.Skipf("symlink not supported: %v", err) |
| 42 | } |
| 43 | |
| 44 | got, err := CanonicalPath(linkPath) |
| 45 | if err != nil { |
| 46 | t.Fatalf("CanonicalPath: %v", err) |
| 47 | } |
| 48 | want, err := filepath.EvalSymlinks(realDir) |
| 49 | if err != nil { |
| 50 | t.Fatalf("EvalSymlinks realDir: %v", err) |
| 51 | } |
| 52 | if got != want { |
| 53 | t.Fatalf("CanonicalPath(%q) = %q, want %q", linkPath, got, want) |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | func TestCanonicalPath_NonExistentPath(t *testing.T) { |
| 58 | _, err := CanonicalPath(filepath.Join(t.TempDir(), "does", "not", "exist")) |
nothing calls this directly
no test coverage detected