ldcache

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LDCache

type LDCache interface {
	List() ([]string, []string)
	Lookup(...string) ([]string, []string)
}

LDCache represents the interface for performing lookups into the LDCache

func New

func New(logger logger.Interface, root string) (LDCache, error)

New creates a new LDCache with the specified logger and root.

type LDCacheMock added in v1.15.0

type LDCacheMock struct {
	// ListFunc mocks the List method.
	ListFunc func() ([]string, []string)

	// LookupFunc mocks the Lookup method.
	LookupFunc func(strings ...string) ([]string, []string)
	// contains filtered or unexported fields
}

LDCacheMock is a mock implementation of LDCache.

func TestSomethingThatUsesLDCache(t *testing.T) {

	// make and configure a mocked LDCache
	mockedLDCache := &LDCacheMock{
		ListFunc: func() ([]string, []string) {
			panic("mock out the List method")
		},
		LookupFunc: func(strings ...string) ([]string, []string) {
			panic("mock out the Lookup method")
		},
	}

	// use mockedLDCache in code that requires LDCache
	// and then make assertions.

}

func (*LDCacheMock) List added in v1.15.0

func (mock *LDCacheMock) List() ([]string, []string)

List calls ListFunc.

func (*LDCacheMock) ListCalls added in v1.15.0

func (mock *LDCacheMock) ListCalls() []struct {
}

ListCalls gets all the calls that were made to List. Check the length with:

len(mockedLDCache.ListCalls())

func (*LDCacheMock) Lookup added in v1.15.0

func (mock *LDCacheMock) Lookup(strings ...string) ([]string, []string)

Lookup calls LookupFunc.

func (*LDCacheMock) LookupCalls added in v1.15.0

func (mock *LDCacheMock) LookupCalls() []struct {
	Strings []string
}

LookupCalls gets all the calls that were made to Lookup. Check the length with:

len(mockedLDCache.LookupCalls())

Jump to

Keyboard shortcuts

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