mocktesting

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package mocktesting is used for mocking out the testing.T interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockTester

type MockTester struct {

	// The testing.TB interface has an unexported method "to prevent users implementing the
	// interface and so future additions to it will not violate Go 1 compatibility."
	//
	// This may cause problems across Go versions, but let's ignore them and
	// work around that restriction by embedding a T so we satisfy the unexported methods of the interface.
	*testing.T
	// contains filtered or unexported fields
}

MockTester is a mock tester. This is used for making sure a test fails using the testing.TB interface and is useful for testing error cases in other test helpers.

func NewMockTester

func NewMockTester(name string) *MockTester

NewMockTester creates a new process tester.

func (*MockTester) Error

func (t *MockTester) Error(args ...interface{})

Error registers an error.

func (*MockTester) Errorf

func (t *MockTester) Errorf(format string, args ...interface{})

Errorf formats the error.

func (*MockTester) Fail

func (t *MockTester) Fail()

Fail fails the process.

func (*MockTester) FailNow

func (t *MockTester) FailNow()

FailNow immediately fails the process.

func (*MockTester) Failed

func (t *MockTester) Failed() bool

Failed indicates whether or not the process failed.

func (*MockTester) Fatal

func (t *MockTester) Fatal(args ...interface{})

Fatal fails instantly.

func (*MockTester) Fatalf

func (t *MockTester) Fatalf(format string, args ...interface{})

Fatalf formats a fail.

func (*MockTester) Helper

func (t *MockTester) Helper()

Helper is used to implement the test helper.

func (*MockTester) Log

func (t *MockTester) Log(args ...interface{})

Log logs the process.

func (*MockTester) Logf

func (t *MockTester) Logf(format string, args ...interface{})

Logf format logs.

func (*MockTester) Name

func (t *MockTester) Name() string

Name gets the test name.

func (*MockTester) Output

func (t *MockTester) Output() []string

Output gets the output of the test.

func (*MockTester) SetOutputHandler

func (t *MockTester) SetOutputHandler(handler func(...interface{}))

SetOutputHandler sets the output handler for the test output.

func (*MockTester) Skip

func (t *MockTester) Skip(args ...interface{})

Skip skips the test.

func (*MockTester) SkipNow

func (t *MockTester) SkipNow()

SkipNow skips the test immediately.

func (*MockTester) Skipf

func (t *MockTester) Skipf(format string, args ...interface{})

Skipf skips the test with formaatting.

func (*MockTester) Skipped

func (t *MockTester) Skipped() bool

Skipped gets whether or not a process was skipped.

Jump to

Keyboard shortcuts

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