Documentation ¶
Index ¶
- type ObjectHandler
- func (handler *ObjectHandler) Add(instanceName string, value interface{})
- func (handler *ObjectHandler) AddObjectByConstructor(instanceName string, constructor reflect.Value, args []string) error
- func (handler *ObjectHandler) Deserialize(objectType reflect.Type, input string) (interface{}, error)
- func (handler *ObjectHandler) Get(instanceName string) interface{}
- func (handler *ObjectHandler) InstancesWithPrefix(prefix string) []interface{}
- func (handler *ObjectHandler) InvokeMemberOn(instance interface{}, memberName string, args *slimentity.SlimList) (slimentity.SlimEntity, error)
- func (handler *ObjectHandler) Length() int
- func (handler *ObjectHandler) Serialize(instance interface{}) string
- func (handler *ObjectHandler) Set(instanceName string, instance interface{}) error
- type Parser
- func (parser *Parser) CallFunction(function reflect.Value, args []string) (returnEntity slimentity.SlimEntity, err error)
- func (parser *Parser) Parse(input string, targetType reflect.Type) (interface{}, error)
- func (parser *Parser) ReplaceSymbols(source interface{}) interface{}
- func (parser *Parser) ReplaceSymbolsIn(source string) string
- func (parser *Parser) SetObjectSerializer(objectSerializer interfaces.ObjectSerializer)
- type SlimInterpreter
- func (slimInterpreter *SlimInterpreter) DoImport(instruction *slimentity.SlimList) slimentity.SlimEntity
- func (slimInterpreter *SlimInterpreter) DoMake(instruction *slimentity.SlimList) slimentity.SlimEntity
- func (slimInterpreter *SlimInterpreter) Process(instructions *slimentity.SlimList) *slimentity.SlimList
- type SlimStatementProcessor
- func (processor *SlimStatementProcessor) DoCall(instanceName, methodName string, args *slimentity.SlimList) slimentity.SlimEntity
- func (processor *SlimStatementProcessor) DoImport(value string) slimentity.SlimEntity
- func (processor *SlimStatementProcessor) DoMake(instanceName, fixtureName string, args *slimentity.SlimList) slimentity.SlimEntity
- func (processor *SlimStatementProcessor) SerializeObjectsIn(input slimentity.SlimEntity) slimentity.SlimEntity
- func (processor *SlimStatementProcessor) SetSymbol(symbol string, value interface{})
- type SymbolTable
- func (symbols *SymbolTable) Add(symbolName string, value interface{})
- func (symbols *SymbolTable) Get(symbolName string) interface{}
- func (symbols *SymbolTable) IsValidSymbolName(source string) bool
- func (symbols *SymbolTable) Length() int
- func (symbols *SymbolTable) NonTextSymbol(symbolName string) (interface{}, bool)
- func (symbols *SymbolTable) Set(symbolName string, value interface{}) error
- func (symbols *SymbolTable) ValueOf(symbolName string) (interface{}, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ObjectHandler ¶
type ObjectHandler struct {
// contains filtered or unexported fields
}
ObjectHandler contains the instantiated fixtures (i.e. objects) and provides functions to handle them.
func NewObjectHandler ¶
func NewObjectHandler(parser interfaces.Parser) *ObjectHandler
NewObjectHandler creates a new ObjectCollection.
func (*ObjectHandler) Add ¶
func (handler *ObjectHandler) Add(instanceName string, value interface{})
Add adds a key value pair to the collection.
func (*ObjectHandler) AddObjectByConstructor ¶
func (handler *ObjectHandler) AddObjectByConstructor(instanceName string, constructor reflect.Value, args []string) error
AddObjectByConstructor adds a new object to the collection by calling a constructor
func (*ObjectHandler) Deserialize ¶
func (handler *ObjectHandler) Deserialize(objectType reflect.Type, input string) (interface{}, error)
Deserialize takes a string representation and converts it into an instantiated object of the required type by calling its Parse method. If it's called with a Struct type, we create a pointer first as Parse is always a pointer receiver. Then we dereference the result.
func (*ObjectHandler) Get ¶
func (handler *ObjectHandler) Get(instanceName string) interface{}
Get returns the entry via its key.
func (*ObjectHandler) InstancesWithPrefix ¶
func (handler *ObjectHandler) InstancesWithPrefix(prefix string) []interface{}
InstancesWithPrefix returns all instances of which the name starts with the prefix.
func (*ObjectHandler) InvokeMemberOn ¶
func (handler *ObjectHandler) InvokeMemberOn(instance interface{}, memberName string, args *slimentity.SlimList) (slimentity.SlimEntity, error)
InvokeMemberOn finds an instance, and invokes a member on it with the given parameters.
func (*ObjectHandler) Length ¶
func (handler *ObjectHandler) Length() int
Length returns the number of items in the collection.
func (*ObjectHandler) Serialize ¶
func (handler *ObjectHandler) Serialize(instance interface{}) string
Serialize returns a serialized representation of an instantiated object (i.e. call its ToString method).
func (*ObjectHandler) Set ¶
func (handler *ObjectHandler) Set(instanceName string, instance interface{}) error
Set sets an existing enty in the collection to a new value.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser provides parsing fuctions
func NewParser ¶
func NewParser(symbols interfaces.SymbolCollector) *Parser
NewParser creates a new Parser.
func (*Parser) CallFunction ¶
func (parser *Parser) CallFunction(function reflect.Value, args []string) (returnEntity slimentity.SlimEntity, err error)
CallFunction calls a function including parsing/marshalling the input parameters and transforming the output. TODO: This is part of the bidirectional dependency issue.
func (*Parser) ReplaceSymbols ¶
func (parser *Parser) ReplaceSymbols(source interface{}) interface{}
ReplaceSymbols does ReplaceSymbolsIn recursively for a SlimList.
func (*Parser) ReplaceSymbolsIn ¶
ReplaceSymbolsIn replaces all occurrences of symbols in a string to their value.
func (*Parser) SetObjectSerializer ¶
func (parser *Parser) SetObjectSerializer(objectSerializer interfaces.ObjectSerializer)
SetObjectSerializer injects the object serializer. We need to do it this way because of a bidirectional relationship.
type SlimInterpreter ¶
type SlimInterpreter struct {
// contains filtered or unexported fields
}
SlimInterpreter processes incomming SlimLists and dispatches commands to its statement processor.
func NewSlimInterpreter ¶
func NewSlimInterpreter(processor interfaces.StatementProcessor, timeout time.Duration) *SlimInterpreter
NewSlimInterpreter creates a new Slim interpreter.
func (*SlimInterpreter) DoImport ¶
func (slimInterpreter *SlimInterpreter) DoImport(instruction *slimentity.SlimList) slimentity.SlimEntity
DoImport executes an Import instruction.
func (*SlimInterpreter) DoMake ¶
func (slimInterpreter *SlimInterpreter) DoMake(instruction *slimentity.SlimList) slimentity.SlimEntity
DoMake executes a Make instruction.
func (*SlimInterpreter) Process ¶
func (slimInterpreter *SlimInterpreter) Process(instructions *slimentity.SlimList) *slimentity.SlimList
Process takes an incoming set of instructions, dispatches to statement processor, and retrieves the result.
type SlimStatementProcessor ¶
type SlimStatementProcessor struct {
// contains filtered or unexported fields
}
SlimStatementProcessor is the implementation of the StatementProcessor interface.
func NewStatementProcessor ¶
func NewStatementProcessor(registry interfaces.Registry, objects interfaces.ObjectHandler, parser interfaces.Parser, symbols interfaces.SymbolCollector) *SlimStatementProcessor
NewStatementProcessor returns a new SlimStatementProcesspr.
func (*SlimStatementProcessor) DoCall ¶
func (processor *SlimStatementProcessor) DoCall(instanceName, methodName string, args *slimentity.SlimList) slimentity.SlimEntity
DoCall calls a method (or property) on an instance.
func (*SlimStatementProcessor) DoImport ¶
func (processor *SlimStatementProcessor) DoImport(value string) slimentity.SlimEntity
DoImport executes an Slim Import command
func (*SlimStatementProcessor) DoMake ¶
func (processor *SlimStatementProcessor) DoMake(instanceName, fixtureName string, args *slimentity.SlimList) slimentity.SlimEntity
DoMake executes a Make command (creating a new instance).
func (*SlimStatementProcessor) SerializeObjectsIn ¶
func (processor *SlimStatementProcessor) SerializeObjectsIn(input slimentity.SlimEntity) slimentity.SlimEntity
SerializeObjectsIn converts all occurrences of an object in a Slim list to their string representations.
func (*SlimStatementProcessor) SetSymbol ¶
func (processor *SlimStatementProcessor) SetSymbol(symbol string, value interface{})
SetSymbol sets a value in the symbol table.
type SymbolTable ¶
type SymbolTable map[string]interface{}
SymbolTable contains the FitNesse symbols.
func (*SymbolTable) Add ¶
func (symbols *SymbolTable) Add(symbolName string, value interface{})
Add adds an entry to the symbol table. TODO: not used. Optimize interfaces.
func (*SymbolTable) Get ¶
func (symbols *SymbolTable) Get(symbolName string) interface{}
Get gets an entry from the symbol table.
func (*SymbolTable) IsValidSymbolName ¶
func (symbols *SymbolTable) IsValidSymbolName(source string) bool
IsValidSymbolName returns whether the input (without the $) is a valid symbol name
func (*SymbolTable) Length ¶
func (symbols *SymbolTable) Length() int
Length gets the number of items in the symbol table. TODO: not used. Optimize interfaces.
func (*SymbolTable) NonTextSymbol ¶
func (symbols *SymbolTable) NonTextSymbol(symbolName string) (interface{}, bool)
NonTextSymbol returhs whether the symbol is valid and contains something else than a string.
func (*SymbolTable) Set ¶
func (symbols *SymbolTable) Set(symbolName string, value interface{}) error
Set sets an entry in the symbol table.
func (*SymbolTable) ValueOf ¶
func (symbols *SymbolTable) ValueOf(symbolName string) (interface{}, bool)
ValueOf should be eliminated.