mocks

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoggerMock

type LoggerMock struct {
	// PrintfFunc mocks the Printf method.
	PrintfFunc func(format string, args ...any) (int, error)
	// contains filtered or unexported fields
}

LoggerMock is a mock implementation of git.Logger.

func TestSomethingThatUsesLogger(t *testing.T) {

	// make and configure a mocked git.Logger
	mockedLogger := &LoggerMock{
		PrintfFunc: func(format string, args ...any) (int, error) {
			panic("mock out the Printf method")
		},
	}

	// use mockedLogger in code that requires git.Logger
	// and then make assertions.

}

func (*LoggerMock) Printf

func (mock *LoggerMock) Printf(format string, args ...any) (int, error)

Printf calls PrintfFunc.

func (*LoggerMock) PrintfCalls

func (mock *LoggerMock) PrintfCalls() []struct {
	Format string
	Args   []any
}

PrintfCalls gets all the calls that were made to Printf. Check the length with:

len(mockedLogger.PrintfCalls())

Jump to

Keyboard shortcuts

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