(t *testing.T)
| 502 | } |
| 503 | |
| 504 | func TestIsExplicitOutputPath(t *testing.T) { |
| 505 | cwd, err := os.Getwd() |
| 506 | if err != nil { |
| 507 | t.Fatalf("failed to get cwd: %v", err) |
| 508 | } |
| 509 | |
| 510 | tempDir := t.TempDir() |
| 511 | |
| 512 | tests := []struct { |
| 513 | name string |
| 514 | outPath string |
| 515 | defaultDir string |
| 516 | want bool |
| 517 | }{ |
| 518 | { |
| 519 | name: "relative and absolute current dir are equal", |
| 520 | outPath: ".", |
| 521 | defaultDir: cwd, |
| 522 | want: false, |
| 523 | }, |
| 524 | { |
| 525 | name: "trailing slash is ignored", |
| 526 | outPath: tempDir + string(filepath.Separator), |
| 527 | defaultDir: tempDir, |
| 528 | want: false, |
| 529 | }, |
| 530 | { |
| 531 | name: "different directories stay explicit", |
| 532 | outPath: filepath.Join(tempDir, "other"), |
| 533 | defaultDir: tempDir, |
| 534 | want: true, |
| 535 | }, |
| 536 | } |
| 537 | |
| 538 | for _, tt := range tests { |
| 539 | t.Run(tt.name, func(t *testing.T) { |
| 540 | if got := isExplicitOutputPath(tt.outPath, tt.defaultDir); got != tt.want { |
| 541 | t.Fatalf("isExplicitOutputPath(%q, %q) = %v, want %v", tt.outPath, tt.defaultDir, got, tt.want) |
| 542 | } |
| 543 | }) |
| 544 | } |
| 545 | } |
nothing calls this directly
no test coverage detected