mocks

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0, 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 ProjectLoaderMock

type ProjectLoaderMock struct {
	// LoadFunc mocks the Load method.
	LoadFunc func(projectPath string) (project.Project, error)
	// contains filtered or unexported fields
}

ProjectLoaderMock is a mock implementation of project.ProjectLoader.

func TestSomethingThatUsesProjectLoader(t *testing.T) {

	// make and configure a mocked project.ProjectLoader
	mockedProjectLoader := &ProjectLoaderMock{
		LoadFunc: func(projectPath string) (project.Project, error) {
			panic("mock out the Load method")
		},
	}

	// use mockedProjectLoader in code that requires project.ProjectLoader
	// and then make assertions.

}

func (*ProjectLoaderMock) Load

func (mock *ProjectLoaderMock) Load(projectPath string) (project.Project, error)

Load calls LoadFunc.

func (*ProjectLoaderMock) LoadCalls

func (mock *ProjectLoaderMock) LoadCalls() []struct {
	ProjectPath string
}

LoadCalls gets all the calls that were made to Load. Check the length with:

len(mockedProjectLoader.LoadCalls())

Jump to

Keyboard shortcuts

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