modules

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module interface {
	Name() string
	GetLoader(script *script.Script) lua.LGFunction
	Stop() error
}

Module is an interface for core module

type ModuleMock

type ModuleMock struct {
	// GetLoaderFunc mocks the GetLoader method.
	GetLoaderFunc func(scriptMoqParam *script.Script) lua.LGFunction

	// NameFunc mocks the Name method.
	NameFunc func() string

	// StopFunc mocks the Stop method.
	StopFunc func() error
	// contains filtered or unexported fields
}

ModuleMock is a mock implementation of Module.

func TestSomethingThatUsesModule(t *testing.T) {

	// make and configure a mocked Module
	mockedModule := &ModuleMock{
		GetLoaderFunc: func(scriptMoqParam *script.Script) lua.LGFunction {
			panic("mock out the GetLoader method")
		},
		NameFunc: func() string {
			panic("mock out the Name method")
		},
		StopFunc: func() error {
			panic("mock out the Stop method")
		},
	}

	// use mockedModule in code that requires Module
	// and then make assertions.

}

func (*ModuleMock) GetLoader

func (mock *ModuleMock) GetLoader(scriptMoqParam *script.Script) lua.LGFunction

GetLoader calls GetLoaderFunc.

func (*ModuleMock) GetLoaderCalls added in v0.8.2

func (mock *ModuleMock) GetLoaderCalls() []struct {
	ScriptMoqParam *script.Script
}

GetLoaderCalls gets all the calls that were made to GetLoader. Check the length with:

len(mockedModule.GetLoaderCalls())

func (*ModuleMock) Name

func (mock *ModuleMock) Name() string

Name calls NameFunc.

func (*ModuleMock) NameCalls added in v0.8.2

func (mock *ModuleMock) NameCalls() []struct {
}

NameCalls gets all the calls that were made to Name. Check the length with:

len(mockedModule.NameCalls())

func (*ModuleMock) Stop

func (mock *ModuleMock) Stop() error

Stop calls StopFunc.

func (*ModuleMock) StopCalls added in v0.8.2

func (mock *ModuleMock) StopCalls() []struct {
}

StopCalls gets all the calls that were made to Stop. Check the length with:

len(mockedModule.StopCalls())

type ModuleTest added in v0.4.0

type ModuleTest interface {
	Name() string
	GetLoader(script *script.Script) lua.LGFunction
	Result() ([]TestResult, error)
	Clean()
}

ModuleTest is an interface for core test module

type ModuleTestMock added in v0.8.2

type ModuleTestMock struct {
	// CleanFunc mocks the Clean method.
	CleanFunc func()

	// GetLoaderFunc mocks the GetLoader method.
	GetLoaderFunc func(scriptMoqParam *script.Script) lua.LGFunction

	// NameFunc mocks the Name method.
	NameFunc func() string

	// ResultFunc mocks the Result method.
	ResultFunc func() ([]TestResult, error)
	// contains filtered or unexported fields
}

ModuleTestMock is a mock implementation of ModuleTest.

func TestSomethingThatUsesModuleTest(t *testing.T) {

	// make and configure a mocked ModuleTest
	mockedModuleTest := &ModuleTestMock{
		CleanFunc: func()  {
			panic("mock out the Clean method")
		},
		GetLoaderFunc: func(scriptMoqParam *script.Script) lua.LGFunction {
			panic("mock out the GetLoader method")
		},
		NameFunc: func() string {
			panic("mock out the Name method")
		},
		ResultFunc: func() ([]TestResult, error) {
			panic("mock out the Result method")
		},
	}

	// use mockedModuleTest in code that requires ModuleTest
	// and then make assertions.

}

func (*ModuleTestMock) Clean added in v0.8.2

func (mock *ModuleTestMock) Clean()

Clean calls CleanFunc.

func (*ModuleTestMock) CleanCalls added in v0.8.2

func (mock *ModuleTestMock) CleanCalls() []struct {
}

CleanCalls gets all the calls that were made to Clean. Check the length with:

len(mockedModuleTest.CleanCalls())

func (*ModuleTestMock) GetLoader added in v0.8.2

func (mock *ModuleTestMock) GetLoader(scriptMoqParam *script.Script) lua.LGFunction

GetLoader calls GetLoaderFunc.

func (*ModuleTestMock) GetLoaderCalls added in v0.8.2

func (mock *ModuleTestMock) GetLoaderCalls() []struct {
	ScriptMoqParam *script.Script
}

GetLoaderCalls gets all the calls that were made to GetLoader. Check the length with:

len(mockedModuleTest.GetLoaderCalls())

func (*ModuleTestMock) Name added in v0.8.2

func (mock *ModuleTestMock) Name() string

Name calls NameFunc.

func (*ModuleTestMock) NameCalls added in v0.8.2

func (mock *ModuleTestMock) NameCalls() []struct {
}

NameCalls gets all the calls that were made to Name. Check the length with:

len(mockedModuleTest.NameCalls())

func (*ModuleTestMock) Result added in v0.8.2

func (mock *ModuleTestMock) Result() ([]TestResult, error)

Result calls ResultFunc.

func (*ModuleTestMock) ResultCalls added in v0.8.2

func (mock *ModuleTestMock) ResultCalls() []struct {
}

ResultCalls gets all the calls that were made to Result. Check the length with:

len(mockedModuleTest.ResultCalls())

type TestResult added in v0.4.0

type TestResult struct {
	ScriptName string `json:"script"`
	ModuleName string `json:"module"`
	Message    string `json:"message"`
	Ok         bool   `json:"ok"`
}

TestResult represents test result

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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