(t *testing.T)
| 617 | } |
| 618 | |
| 619 | func TestWriteJSONFile_MarshalError(t *testing.T) { |
| 620 | dir := t.TempDir() |
| 621 | |
| 622 | // Channels cannot be marshaled to JSON |
| 623 | err := writeJSONFile(dir, "bad.json", make(chan int)) |
| 624 | if err == nil { |
| 625 | t.Fatal("expected error when marshaling unmarshalable value") |
| 626 | } |
| 627 | if !strings.Contains(err.Error(), "failed to marshal") { |
| 628 | t.Errorf("expected 'failed to marshal' error, got: %v", err) |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | func TestWriteJSONFile_InvalidDir(t *testing.T) { |
| 633 | // Create a file where a directory is expected |
nothing calls this directly
no test coverage detected