package linthost

import (
  "bytes"
  "testing"

  shimdw "github.com/microsoft/typescript-go/shim/diagnosticwriter"
)

// TestMixedDiagnosticsRenderEmptyIsSilent verifies the shared renderer keeps
// the zero-diagnostic fast path silent after mixed-order support is added.
//
// 1. Render an empty parser and lint batch.
// 2. Observe the returned error count and captured output.
// 3. Assert no summary or diagnostic text was introduced.
//
// @evidence contracts/testing.md#behavioral-verification Actual shared diagnostic rendering of empty parser and lint collections writes no diagnostic or summary bytes and returns zero errors.
// @evidence contracts/testing.md#independent-expectations Literal empty output and zero count independently specify the no-diagnostic protocol; no expected output is generated by a second renderer invocation.
// @evidence contracts/testing.md#distinguishing-cases Both collections are absent; populated mixed error/warning batches in sibling units provide positive output and count controls.
// @evidence contracts/testing.md#execution-ownership The supported Go diagnostic writer operates on an in-memory buffer directly in-process without CLI rendering, native production, installation or file-existence checks.
func TestMixedDiagnosticsRenderEmptyIsSilent(t *testing.T) {
  var rendered bytes.Buffer
  if got := shimdw.FormatMixedDiagnostics(&rendered, nil, nil, "/virtual"); got != 0 {
    t.Fatalf("empty render error count = %d, want 0", got)
  }
  if rendered.Len() != 0 {
    t.Fatalf("empty render produced output: %q", rendered.String())
  }
}
