(t *testing.T)
| 37 | } |
| 38 | |
| 39 | func TestJSONWriterWriteEnabled(t *testing.T) { |
| 40 | writer := NewJSONWriter(true) |
| 41 | |
| 42 | out, err := captureStdout(t, func() error { |
| 43 | return writer.Write(map[string]string{"status": "ok"}) |
| 44 | }) |
| 45 | if err != nil { |
| 46 | t.Fatalf("expected no error, got %v", err) |
| 47 | } |
| 48 | |
| 49 | if strings.TrimSpace(out) != `{"status":"ok"}` { |
| 50 | t.Fatalf("unexpected output: %q", out) |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | func TestJSONWriterWriteDisabled(t *testing.T) { |
| 55 | writer := NewJSONWriter(false) |
nothing calls this directly
no test coverage detected