interfacestest

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RendererMock

type RendererMock struct {
	// DoFunc mocks the Do method.
	DoFunc func(path string, b []byte) ([]byte, error)
	// contains filtered or unexported fields
}

RendererMock is a mock implementation of interfaces.Renderer.

    func TestSomethingThatUsesRenderer(t *testing.T) {

        // make and configure a mocked interfaces.Renderer
        mockedRenderer := &RendererMock{
            DoFunc: func(path string, b []byte) ([]byte, error) {
	               panic("mock out the Do method")
            },
        }

        // use mockedRenderer in code that requires interfaces.Renderer
        // and then make assertions.

    }

func (*RendererMock) Do

func (mock *RendererMock) Do(path string, b []byte) ([]byte, error)

Do calls DoFunc.

func (*RendererMock) DoCalls

func (mock *RendererMock) DoCalls() []struct {
	Path string
	B    []byte
}

DoCalls gets all the calls that were made to Do. Check the length with:

len(mockedRenderer.DoCalls())

Jump to

Keyboard shortcuts

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