modules

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job added in v0.8.3

type Job interface {
	Script() *script.Script
	GetPriorExecutionTime() time.Duration
	GetCronLocation() *time.Location
}

type JobMock added in v0.8.3

type JobMock struct {
	// GetCronLocationFunc mocks the GetCronLocation method.
	GetCronLocationFunc func() *time.Location

	// GetPriorExecutionTimeFunc mocks the GetPriorExecutionTime method.
	GetPriorExecutionTimeFunc func() time.Duration

	// ScriptFunc mocks the Script method.
	ScriptFunc func() *script.Script
	// contains filtered or unexported fields
}

JobMock is a mock implementation of Job.

func TestSomethingThatUsesJob(t *testing.T) {

	// make and configure a mocked Job
	mockedJob := &JobMock{
		GetCronLocationFunc: func() *time.Location {
			panic("mock out the GetCronLocation method")
		},
		GetPriorExecutionTimeFunc: func() time.Duration {
			panic("mock out the GetPriorExecutionTime method")
		},
		ScriptFunc: func() *script.Script {
			panic("mock out the Script method")
		},
	}

	// use mockedJob in code that requires Job
	// and then make assertions.

}

func (*JobMock) GetCronLocation added in v0.8.3

func (mock *JobMock) GetCronLocation() *time.Location

GetCronLocation calls GetCronLocationFunc.

func (*JobMock) GetCronLocationCalls added in v0.8.3

func (mock *JobMock) GetCronLocationCalls() []struct {
}

GetCronLocationCalls gets all the calls that were made to GetCronLocation. Check the length with:

len(mockedJob.GetCronLocationCalls())

func (*JobMock) GetPriorExecutionTime added in v0.8.3

func (mock *JobMock) GetPriorExecutionTime() time.Duration

GetPriorExecutionTime calls GetPriorExecutionTimeFunc.

func (*JobMock) GetPriorExecutionTimeCalls added in v0.8.3

func (mock *JobMock) GetPriorExecutionTimeCalls() []struct {
}

GetPriorExecutionTimeCalls gets all the calls that were made to GetPriorExecutionTime. Check the length with:

len(mockedJob.GetPriorExecutionTimeCalls())

func (*JobMock) Script added in v0.8.3

func (mock *JobMock) Script() *script.Script

Script calls ScriptFunc.

func (*JobMock) ScriptCalls added in v0.8.3

func (mock *JobMock) ScriptCalls() []struct {
}

ScriptCalls gets all the calls that were made to Script. Check the length with:

len(mockedJob.ScriptCalls())

type Module

type Module interface {
	Name() string
	GetLoader(j Job) lua.LGFunction
	Stop() error
}

Module is an interface for core module

type ModuleMock

type ModuleMock struct {
	// GetLoaderFunc mocks the GetLoader method.
	GetLoaderFunc func(j Job) 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(j Job) 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(j Job) lua.LGFunction

GetLoader calls GetLoaderFunc.

func (*ModuleMock) GetLoaderCalls added in v0.8.2

func (mock *ModuleMock) GetLoaderCalls() []struct {
	J Job
}

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(j Job) 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(j Job) 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(j Job) 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(j Job) lua.LGFunction

GetLoader calls GetLoaderFunc.

func (*ModuleTestMock) GetLoaderCalls added in v0.8.2

func (mock *ModuleTestMock) GetLoaderCalls() []struct {
	J Job
}

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"`
	TestFuncName string `json:"test"`
	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