internal

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fail

func Fail(t TestingT, fatalOnFailure bool, str string, msg ...string)

Fail reports an assertion failure using the provided TestingT. If fatalOnFailure is true, it calls `t.Fatal`; otherwise, it calls `t.Error`.

func Panic

func Panic(t TestingT, fatalOnFailure bool, fn func(), expr string, msg ...string)

Panic asserts that fn panics and the panic message matches expr. It reports an error if fn does not panic or if the recovered message does not satisfy expr.

Types

type MockTestingT

type MockTestingT struct {
	// contains filtered or unexported fields
}

MockTestingT simulates *testing.T for testing purposes. It records output in a buffer for verification during tests.

func (*MockTestingT) Error

func (m *MockTestingT) Error(args ...any)

Error writes error messages to the internal buffer.

func (*MockTestingT) Fatal

func (m *MockTestingT) Fatal(args ...any)

Fatal writes fatal messages to the internal buffer.

func (*MockTestingT) Helper

func (m *MockTestingT) Helper()

func (*MockTestingT) Reset

func (m *MockTestingT) Reset()

Reset clears the internal buffer.

func (*MockTestingT) String

func (m *MockTestingT) String() string

String returns the current content of the buffer.

type TestingT

type TestingT interface {
	Helper()
	Error(args ...any)
	Fatal(args ...any)
}

TestingT is the minimum interface of *testing.T. It provides basic methods for reporting test errors or failures.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL