testmoqs

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package testmoqs contains multiple test mocks and adaptors for use in unit testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type B added in v0.27.0

type B struct{}

The following unused structs check that the AST cache doesn't pick up the wrong types

type DifficultParamNamesFn

type DifficultParamNamesFn func(m, r bool, sequence string, param, params, i int, result, results, _ float32)

DifficultParamNamesFn has parameters with names that have been problematic

type DifficultResultNamesFn

type DifficultResultNamesFn func() (m, r string, sequence error, param, params, i int, result, results, _ float32)

DifficultResultNamesFn has parameters with names that have been problematic

type E added in v0.27.0

type E struct{}

The following unused structs check that the AST cache doesn't pick up the wrong types

type GenericInterfaceParam added in v0.27.0

type GenericInterfaceParam[W MyWriter] interface {
	Usual(w W) (sResult string, err error)
}

type GenericInterfaceParamFn added in v0.27.0

type GenericInterfaceParamFn[W MyWriter] func(w W) (sResult string, err error)

GenericInterfaceParamFn tests passing generic interface parameters

type GenericInterfaceResult added in v0.27.0

type GenericInterfaceResult[R MyReader] interface {
	Usual(sParam string, bParam bool) (r R)
}

type GenericInterfaceResultFn added in v0.27.0

type GenericInterfaceResultFn[R MyReader] func(sParam string, bParam bool) (r R)

GenericInterfaceResultFn tests returning generic interface results

type GenericParams added in v0.27.0

type GenericParams[S, B any] interface {
	Usual(S, B) (string, error)
}

type GenericParamsFn added in v0.27.0

type GenericParamsFn[S, B any] func(S, B) (string, error)

GenericParamsFn has all generic parameters

type GenericResults added in v0.27.0

type GenericResults[S ~string, E error] interface {
	Usual(string, bool) (S, E)
}

type GenericResultsFn added in v0.27.0

type GenericResultsFn[S ~string, E error] func(string, bool) (S, E)

GenericResultsFn has all generic results

type InterfaceParamFn

type InterfaceParamFn func(w io.Writer) (sResult string, err error)

InterfaceParamFn tests passing interface parameters

type InterfaceParamWriter

type InterfaceParamWriter struct {
	SParam string
	BParam bool
}

InterfaceParamWriter is used for testing functions that take an interface as a parameter

func (*InterfaceParamWriter) Write

func (w *InterfaceParamWriter) Write([]byte) (int, error)

type InterfaceResultFn

type InterfaceResultFn func(sParam string, bParam bool) (r io.Reader)

InterfaceResultFn tests returning interface results

type InterfaceResultReader

type InterfaceResultReader struct {
	SResult string
	Err     error
}

InterfaceResultReader is used for testing functions that return an interface

func (*InterfaceResultReader) Read

func (r *InterfaceResultReader) Read([]byte) (int, error)

type MyReader added in v0.27.0

type MyReader io.Reader

type MyWriter added in v0.27.0

type MyWriter io.Writer

type NoNamesFn

type NoNamesFn func(string, bool) (string, error)

NoNamesFn is a typical function type

type NoParamsFn

type NoParamsFn func() (sResult string, err error)

NoParamsFn is a function with no parameters

type NoResultsFn

type NoResultsFn func(sParam string, bParam bool)

NoResultsFn is a function with no return values

type NothingFn

type NothingFn func()

NothingFn is a function with no parameters and no return values

type Params added in v0.27.0

type Params struct {
	SParam string
	BParam bool
}

Params encapsulates the parameters for use in various test types

type PartialGenericParams added in v0.27.0

type PartialGenericParams[S any] interface {
	Usual(S, bool) (string, error)
}

type PartialGenericParamsFn added in v0.27.0

type PartialGenericParamsFn[S any] func(S, bool) (string, error)

PartialGenericParamsFn has some generic parameters

type PartialGenericResults added in v0.27.0

type PartialGenericResults[S ~string] interface {
	Usual(string, bool) (S, error)
}

type PartialGenericResultsFn added in v0.27.0

type PartialGenericResultsFn[S ~string] func(string, bool) (S, error)

PartialGenericResultsFn has some generic results

type PassByArrayFn added in v0.27.0

type PassByArrayFn func(p [3]Params) [3]Results

PassByArrayFn tests passing parameters and results by array

type PassByChanFn added in v0.27.0

type PassByChanFn func(p chan Params) chan Results

PassByChanFn tests passing parameters and results by channel

type PassByEllipsisFn added in v0.27.0

type PassByEllipsisFn func(p ...Params) (string, error)

PassByEllipsisFn tests passing parameters by ellipsis

type PassByMapFn added in v0.27.0

type PassByMapFn func(p map[string]Params) map[string]Results

PassByMapFn tests passing parameters and results by map

type PassByReferenceFn

type PassByReferenceFn func(p *Params) *Results

PassByReferenceFn tests passing parameters and results by reference

type PassBySliceFn added in v0.27.0

type PassBySliceFn func(p []Params) []Results

PassBySliceFn tests passing parameters and results by slice

type PassByValueFn added in v0.27.0

type PassByValueFn func(p Params) Results

PassByValueFn tests passing parameters and results by reference

type RepeatedIdsFn

type RepeatedIdsFn func(sParam1, sParam2 string, bParam bool) (sResult1, sResult2 string, err error)

RepeatedIdsFn is a function with multiple arguments of the same type

type Results added in v0.27.0

type Results struct {
	SResult string
	Err     error
}

Results encapsulates the results for use in various test types

type S added in v0.27.0

type S struct{}

The following unused structs check that the AST cache doesn't pick up the wrong types

type TimesFn

type TimesFn func(times string, bParam bool) (sResult string, err error)

TimesFn takes a parameter called times which should generate a valid moq

type UnsafePointerFn added in v0.27.0

type UnsafePointerFn func() unsafe.Pointer

type Usual

type Usual interface {
	Usual(sParam string, bParam bool) (sResult string, err error)
	NoNames(string, bool) (string, error)
	NoResults(sParam string, bParam bool)
	NoParams() (sResult string, err error)
	Nothing()
	Variadic(other bool, args ...string) (sResult string, err error)
	RepeatedIds(sParam1, sParam2 string, bParam bool) (sResult1, sResult2 string, err error)
	Times(sParam string, times bool) (sResult string, err error)
	DifficultParamNames(m, r bool, sequence string, param, params, i int, result, results, _ float32)
	DifficultResultNames() (m, r string, sequence error, param, params, i int, result, results, _ float32)
	PassByArray(p [3]Params) [3]Results
	PassByChan(p chan Params) chan Results
	PassByEllipsis(p ...Params) (string, error)
	PassByMap(p map[string]Params) map[string]Results
	PassByReference(p *Params) *Results
	PassBySlice(p []Params) []Results
	PassByValue(p Params) Results
	InterfaceParam(w io.Writer) (sResult string, err error)
	InterfaceResult(sParam string, bParam bool) (r io.Reader)
	FnParam(fn func())
	other.Other
}

Usual combines all the above function types into an interface

type UsualFn

type UsualFn func(sParam string, bParam bool) (sResult string, err error)

UsualFn is a typical function type

type VariadicFn

type VariadicFn func(other bool, args ...string) (sResult string, err error)

VariadicFn is a function with a variable number of arguments

type W added in v0.27.0

type W struct{}

The following unused structs check that the AST cache doesn't pick up the wrong types

Directories

Path Synopsis
Package other contains multiple test types for use in unit testing
Package other contains multiple test types for use in unit testing

Jump to

Keyboard shortcuts

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