test

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: MPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalErrorParser

func EvalErrorParser(s schema.Schema, word string) parser.Func

EvalErrorParser returns with a parser which will read the "ERR" string but the result node evaluation will throw an error

func EvalUserCtx

func EvalUserCtx() *conflow.EvalContext

func ExpectBlockToEvaluate

func ExpectBlockToEvaluate(p parsley.Parser, registry parsley.NodeTransformerRegistry) func(string, interface{}, func(interface{}, interface{}, string))

func ExpectBlockToHaveEvalError

func ExpectBlockToHaveEvalError(p parsley.Parser, registry parsley.NodeTransformerRegistry) func(string, types.GomegaMatcher)

func ExpectBlockToHaveParseError

func ExpectBlockToHaveParseError(p parsley.Parser, registry parsley.NodeTransformerRegistry) func(string, types.GomegaMatcher)

func ExpectFunctionNode

func ExpectFunctionNode(p parsley.Parser, registry parsley.NodeTransformerRegistry) func(string, func(interface{}, parsley.Node))

func ExpectFunctionToEvaluate

func ExpectFunctionToEvaluate(p parsley.Parser, registry parsley.NodeTransformerRegistry) func(string, interface{})

func ExpectFunctionToHaveEvalError

func ExpectFunctionToHaveEvalError(p parsley.Parser, registry parsley.NodeTransformerRegistry) func(string, error)

func ExpectFunctionToHaveParseError

func ExpectFunctionToHaveParseError(p parsley.Parser, registry parsley.NodeTransformerRegistry) func(string, error)

func ExpectParserToEvaluate

func ExpectParserToEvaluate(p parsley.Parser) func(string, interface{})

func ExpectParserToHaveEvalError

func ExpectParserToHaveEvalError(p parsley.Parser) func(string, error)

func ExpectParserToHaveParseError

func ExpectParserToHaveParseError(p parsley.Parser) func(string, error)

func ExpectParserToHaveStaticCheckError

func ExpectParserToHaveStaticCheckError(p parsley.Parser) func(string, error)

func ExpectParserToReturn

func ExpectParserToReturn(p parsley.Parser, input string, expected parsley.Node)

func FTableEntry

func FTableEntry(input string, parameters ...interface{}) table.TableEntry

FTableEntry creates an custom focused entry for table driven tests where the input is the description

func MapParser

func MapParser(word string, value map[string]interface{}) parser.Func

MapParser returns with a parser which will read the "MAP" string but the result will return a sample map

func ParseCtx

func ParseCtx(
	input string,
	blockRegistry parsley.NodeTransformerRegistry,
	functionRegistry parsley.NodeTransformerRegistry,
) *parsley.Context

func TableEntry

func TableEntry(input string, parameters ...interface{}) table.TableEntry

TableEntry creates an custom entry for table driven tests where the input is the description

Types

type Block

type Block struct {
	// @id
	IDField conflow.ID
	// @value
	Value             interface{}
	FieldString       string
	FieldInt          int64
	FieldFloat        float64
	FieldBool         bool
	FieldArray        []interface{}
	FieldMap          map[string]interface{}
	FieldTimeDuration time.Duration
	// @name "custom_field"
	FieldCustomName string

	// @name "testblock"
	BlockArray []*Block

	// @name "testblockmap"
	BlockMap map[string]*Block
}

@block "configuration"

func (*Block) Compare

func (b *Block) Compare(b2 *Block, input string)

func (*Block) ID

func (b *Block) ID() conflow.ID

func (*Block) ParseContextOverride

func (b *Block) ParseContextOverride() conflow.ParseContextOverride

type BlockInterpreter

type BlockInterpreter struct {
}

BlockInterpreter is the Conflow interpreter for the Block block

func (BlockInterpreter) CreateBlock

func (i BlockInterpreter) CreateBlock(id conflow.ID, blockCtx *conflow.BlockContext) conflow.Block

Create creates a new Block block

func (BlockInterpreter) Param

func (i BlockInterpreter) Param(b conflow.Block, name conflow.ID) interface{}

func (BlockInterpreter) ParseContext

ParseContext returns with the parse context for the block

func (BlockInterpreter) Schema

func (i BlockInterpreter) Schema() schema.Schema

func (BlockInterpreter) SetBlock

func (i BlockInterpreter) SetBlock(block conflow.Block, name conflow.ID, key string, value interface{}) error

func (BlockInterpreter) SetParam

func (i BlockInterpreter) SetParam(block conflow.Block, name conflow.ID, value interface{}) error

func (BlockInterpreter) ValueParamName

func (i BlockInterpreter) ValueParamName() conflow.ID

ValueParamName returns the name of the parameter marked as value field, if there is one set

type BlockWithClose

type BlockWithClose interface {
	conflow.Block
	conflow.BlockCloser
}

type BlockWithInit

type BlockWithInit interface {
	conflow.Block
	conflow.BlockInitialiser
}

type BlockWithRun

type BlockWithRun interface {
	conflow.Block
	conflow.BlockRunner
}

type Directive

type Directive struct {
	// @id
	IDField conflow.ID
	// @value
	Value             interface{}
	FieldString       string
	FieldInt          int64
	FieldFloat        float64
	FieldBool         bool
	FieldArray        []interface{}
	FieldMap          map[string]interface{}
	FieldTimeDuration time.Duration
	// @name "custom_field"
	FieldCustomName string

	// @name "testblock"
	Blocks []*Block
}

@block "directive"

func (*Directive) ApplyToRuntimeConfig

func (d *Directive) ApplyToRuntimeConfig(config *conflow.RuntimeConfig)

func (*Directive) Compare

func (d *Directive) Compare(d2 *Directive, input string)

func (*Directive) EvalStage

func (d *Directive) EvalStage() conflow.EvalStage

func (*Directive) ID

func (d *Directive) ID() conflow.ID

func (*Directive) ParseContextOverride

func (d *Directive) ParseContextOverride() conflow.ParseContextOverride

type DirectiveInterpreter

type DirectiveInterpreter struct {
}

DirectiveInterpreter is the Conflow interpreter for the Directive block

func (DirectiveInterpreter) CreateBlock

func (i DirectiveInterpreter) CreateBlock(id conflow.ID, blockCtx *conflow.BlockContext) conflow.Block

Create creates a new Directive block

func (DirectiveInterpreter) Param

func (i DirectiveInterpreter) Param(b conflow.Block, name conflow.ID) interface{}

func (DirectiveInterpreter) ParseContext

ParseContext returns with the parse context for the block

func (DirectiveInterpreter) Schema

func (i DirectiveInterpreter) Schema() schema.Schema

func (DirectiveInterpreter) SetBlock

func (i DirectiveInterpreter) SetBlock(block conflow.Block, name conflow.ID, key string, value interface{}) error

func (DirectiveInterpreter) SetParam

func (i DirectiveInterpreter) SetParam(block conflow.Block, name conflow.ID, value interface{}) error

func (DirectiveInterpreter) ValueParamName

func (i DirectiveInterpreter) ValueParamName() conflow.ID

ValueParamName returns the name of the parameter marked as value field, if there is one set

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

Scheduler is a test scheduler, it will simply run the given job in a goroutine in the background

func (*Scheduler) ScheduleJob

func (s *Scheduler) ScheduleJob(job conflow.Job) error

type TestFunc0Interpreter

type TestFunc0Interpreter struct {
}

TestFunc0Interpreter is the Conflow interpreter for the testFunc0 function

func (TestFunc0Interpreter) Eval

func (i TestFunc0Interpreter) Eval(ctx interface{}, args []interface{}) (interface{}, error)

Eval returns with the result of the function

func (TestFunc0Interpreter) Schema

func (i TestFunc0Interpreter) Schema() schema.Schema

type TestFunc1Interpreter

type TestFunc1Interpreter struct {
}

TestFunc1Interpreter is the Conflow interpreter for the testFunc1 function

func (TestFunc1Interpreter) Eval

func (i TestFunc1Interpreter) Eval(ctx interface{}, args []interface{}) (interface{}, error)

Eval returns with the result of the function

func (TestFunc1Interpreter) Schema

func (i TestFunc1Interpreter) Schema() schema.Schema

type TestFunc2Interpreter

type TestFunc2Interpreter struct {
}

TestFunc2Interpreter is the Conflow interpreter for the testFunc2 function

func (TestFunc2Interpreter) Eval

func (i TestFunc2Interpreter) Eval(ctx interface{}, args []interface{}) (interface{}, error)

Eval returns with the result of the function

func (TestFunc2Interpreter) Schema

func (i TestFunc2Interpreter) Schema() schema.Schema

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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