TestReadFileAnyMissingBoth verifies ReadFileAny returns fs.ErrNotExist when neither format's file is present.
(t *testing.T)
| 574 | // TestReadFileAnyMissingBoth verifies ReadFileAny returns fs.ErrNotExist |
| 575 | // when neither format's file is present. |
| 576 | func TestReadFileAnyMissingBoth(t *testing.T) { |
| 577 | ctx := context.Background() |
| 578 | logger := testLogger() |
| 579 | |
| 580 | tempDir, err := os.MkdirTemp("", "readfile_any_missing_test") |
| 581 | if err != nil { |
| 582 | t.Fatal(err) |
| 583 | } |
| 584 | defer os.RemoveAll(tempDir) |
| 585 | |
| 586 | _, _, err = ReadFileAny(ctx, logger, tempDir, "nope", FormatJSON) |
| 587 | if err == nil { |
| 588 | t.Fatal("expected error, got nil") |
| 589 | } |
| 590 | if !os.IsNotExist(err) { |
| 591 | t.Errorf("expected os.IsNotExist, got %v", err) |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | // TestFileExistsAnyDetection verifies FileExistsAny reports the correct |
| 596 | // detected format regardless of what the caller prefers. |
nothing calls this directly
no test coverage detected