aboutsummaryrefslogtreecommitdiff
path: root/assert/assert.go
blob: 7b7502600417202f9bc8ee8f1fdeec8243250130 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// SPDX-FileCopyrightText: 2026 Stefan Majewsky <majewsky@gmx.net>
// SPDX-License-Identifier: Apache-2.0

// Package assert contains assertions for use in unit tests.
// Each assertion in this package returns a bool to indicate whether the check succeeded, and logs a t.Error() when the check does not succeed.
package assert

import "go.xyrillian.de/gg/testcapture"

// TestingTB contains all the public functions of [testing.TB] (as of Go 1.26).
// Functions in this package use this type instead of [testing.TB] to allow
// mocks of [testing.TB] to be substituted in tests for this package.
type TestingTB = testcapture.TestingTB

// TODO: with 1.27 generic methods, we can finally build a worthy successor to go-bits/must.{SucceedT,ReturnT}: must := assert.Must(t), then must.Return() and must.Succeed() as normal; normal must.{Succeed,Return} should panic if testing.Testing