Files

22 lines
614 B
Go

// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
// SPDX-FileCopyrightText: 2025-2026 Christian Galo
// Package testkit holds helpers any test can use. It imports no console
// package, only io and testing, so every package's tests can import it without
// a cycle.
package testkit
import (
"io"
"testing"
)
// Close closes c and reports a failed Close on tb, so a test that leaks a
// connection or loses a write fails instead of passing on a swallowed error.
func Close(tb testing.TB, c io.Closer) {
tb.Helper()
if err := c.Close(); err != nil {
tb.Errorf("close %T: %v", c, err)
}
}