parser

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2016 License: GPL-3.0, GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SpecHeading     = 0
	ScenarioHeading = 1
)

Variables

This section is empty.

Functions

func ConvertToProtoItem

func ConvertToProtoItem(item Item) *gauge_messages.ProtoItem

func ConvertToProtoSpec

func ConvertToProtoSpec(spec *Specification) *gauge_messages.ProtoSpec

func ConvertToProtoStepValue

func ConvertToProtoStepValue(stepValue *StepValue) *gauge_messages.ProtoStepValue

func ConvertToProtoSuiteResult

func ConvertToProtoSuiteResult(suiteResult *result.SuiteResult) *gauge_messages.ProtoSuiteResult

func ConvertToStepText

func ConvertToStepText(fragments []*gauge_messages.Fragment) string

func CreateConceptsDictionary

func CreateConceptsDictionary(shouldIgnoreErrors bool) (*ConceptDictionary, *ParseResult)

func FindSpecs

func FindSpecs(specSource string, conceptDictionary *ConceptDictionary) ([]*Specification, []*ParseResult)

func GetUnescapedString

func GetUnescapedString(string1 string) string

func HandleParseResult

func HandleParseResult(results ...*ParseResult)

func NewProtoScenario

func NewProtoScenario(scenario *Scenario) *gauge_messages.ProtoScenario

func NewSpecResult

func NewSpecResult(specification *Specification) *result.SpecResult

func ParseSpecFiles

func ParseSpecFiles(specFiles []string, conceptDictionary *ConceptDictionary) ([]*Specification, []*ParseResult)

func PopulateConceptDynamicParams

func PopulateConceptDynamicParams(concept *Step, dataTableLookup *ArgLookup)

Creating a copy of the lookup and populating table values

Types

type ArgLookup

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

func (*ArgLookup) FromDataTableRow

func (lookup *ArgLookup) FromDataTableRow(datatable *Table, index int) *ArgLookup

func (ArgLookup) String

func (argLookup ArgLookup) String() string

type ArgType

type ArgType string
const (
	Static               ArgType = "static"
	Dynamic              ArgType = "dynamic"
	TableArg             ArgType = "table"
	SpecialString        ArgType = "special_string"
	SpecialTable         ArgType = "special_table"
	ParameterPlaceholder         = "{}"
)

type ByLineNo

type ByLineNo []*Concept

func (ByLineNo) Len

func (s ByLineNo) Len() int

func (ByLineNo) Less

func (s ByLineNo) Less(i, j int) bool

func (ByLineNo) Swap

func (s ByLineNo) Swap(i, j int)

type Comment

type Comment struct {
	Value  string
	LineNo int
}

func (*Comment) Kind

func (comment *Comment) Kind() TokenKind

type Concept

type Concept struct {
	ConceptStep *Step
	FileName    string
}

type ConceptDictionary

type ConceptDictionary struct {
	ConceptsMap map[string]*Concept
	// contains filtered or unexported fields
}

func NewConceptDictionary

func NewConceptDictionary() *ConceptDictionary

type ConceptParser

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

func (*ConceptParser) Parse

func (parser *ConceptParser) Parse(text string) ([]*Step, *ParseDetailResult)

concept file can have multiple concept headings

func (*ConceptParser) ParseFile added in v0.1.8

func (parser *ConceptParser) ParseFile(file string) ([]*Step, *ParseDetailResult)

type DataTable

type DataTable struct {
	Table      Table
	Value      string
	LineNo     int
	IsExternal bool
}

func (*DataTable) IsInitialized

func (dataTable *DataTable) IsInitialized() bool

func (*DataTable) Kind

func (externalTable *DataTable) Kind() TokenKind

type Heading

type Heading struct {
	Value       string
	LineNo      int
	HeadingType HeadingType
}

func (*Heading) Kind

func (heading *Heading) Kind() TokenKind

type HeadingType

type HeadingType int

type Item

type Item interface {
	Kind() TokenKind
}

type ParamResolver

type ParamResolver struct {
}

func (*ParamResolver) GetResolvedParams

func (paramResolver *ParamResolver) GetResolvedParams(step *Step, parent *Step, dataTableLookup *ArgLookup) []*gauge_messages.Parameter

type ParseDetailResult

type ParseDetailResult struct {
	Error    *ParseError
	Warnings []*Warning
}

type ParseError

type ParseError struct {
	LineNo   int
	Message  string
	LineText string
}

func AddConcepts

func AddConcepts(conceptFile string, conceptDictionary *ConceptDictionary) *ParseError

func (*ParseError) Error

func (se *ParseError) Error() string

type ParseResult

type ParseResult struct {
	ParseError *ParseError
	Warnings   []*Warning
	Ok         bool
	FileName   string
}

func (*ParseResult) Error

func (result *ParseResult) Error() string

type Scenario

type Scenario struct {
	Heading  *Heading
	Steps    []*Step
	Comments []*Comment
	Tags     *Tags
	Items    []Item
}

func (Scenario) Kind

func (scenario Scenario) Kind() TokenKind

func (*Scenario) Traverse

func (scenario *Scenario) Traverse(traverser ScenarioTraverser)

type ScenarioTraverser

type ScenarioTraverser interface {
	ScenarioHeading(*Heading)
	ScenarioTags(*Tags)
	Step(*Step)
	Comment(*Comment)
}

type SpecItemFilter

type SpecItemFilter interface {
	Filter(Item) bool
}

type SpecParser

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

func (*SpecParser) CreateSpecification

func (specParser *SpecParser) CreateSpecification(tokens []*Token, conceptDictionary *ConceptDictionary) (*Specification, *ParseResult)

func (*SpecParser) GenerateTokens

func (parser *SpecParser) GenerateTokens(specText string) ([]*Token, *ParseError)

func (*SpecParser) Parse

func (parser *SpecParser) Parse(specText string, conceptDictionary *ConceptDictionary) (*Specification, *ParseResult)

type SpecTraverser

type SpecTraverser interface {
	SpecHeading(*Heading)
	SpecTags(*Tags)
	DataTable(*Table)
	ExternalDataTable(*DataTable)
	ContextStep(*Step)
	Scenario(*Scenario)
	ScenarioHeading(*Heading)
	ScenarioTags(*Tags)
	Step(*Step)
	TearDown(*TearDown)
	Comment(*Comment)
}

type Specification

type Specification struct {
	Heading       *Heading
	Scenarios     []*Scenario
	Comments      []*Comment
	DataTable     DataTable
	Contexts      []*Step
	FileName      string
	Tags          *Tags
	Items         []Item
	TearDownSteps []*Step
}

func (*Specification) CreateStepUsingLookup

func (spec *Specification) CreateStepUsingLookup(stepToken *Token, lookup *ArgLookup) (*Step, *ParseDetailResult)

func (*Specification) Filter

func (spec *Specification) Filter(filter SpecItemFilter)

func (*Specification) GetSpecItems

func (specification *Specification) GetSpecItems() []Item

func (*Specification) RenameSteps

func (spec *Specification) RenameSteps(oldStep Step, newStep Step, orderMap map[int]int) bool

func (*Specification) Traverse

func (spec *Specification) Traverse(traverser SpecTraverser)

type Step

type Step struct {
	LineNo         int
	Value          string
	LineText       string
	Args           []*StepArg
	IsConcept      bool
	Lookup         ArgLookup
	ConceptSteps   []*Step
	Fragments      []*gauge_messages.Fragment
	Parent         *Step
	HasInlineTable bool
	Items          []Item
	PreComments    []*Comment
}

func CreateStepFromStepRequest

func CreateStepFromStepRequest(stepReq *gauge_messages.ExecuteStepRequest) *Step

func (Step) Kind

func (step Step) Kind() TokenKind

func (*Step) PopulateFragments

func (step *Step) PopulateFragments()

func (*Step) Rename

func (step *Step) Rename(oldStep Step, newStep Step, isRefactored bool, orderMap map[int]int, isConcept *bool) bool

func (*Step) ReplaceArgsWithDynamic

func (step *Step) ReplaceArgsWithDynamic(args []*StepArg)

type StepArg

type StepArg struct {
	Name    string
	Value   string
	ArgType ArgType
	Table   Table
}

func (*StepArg) String

func (stepArg *StepArg) String() string

type StepValue

type StepValue struct {
	Args                   []string
	StepValue              string
	ParameterizedStepValue string
}

func CreateStepValue

func CreateStepValue(step *Step) StepValue

func ExtractStepValueAndParams

func ExtractStepValueAndParams(stepText string, hasInlineTable bool) (*StepValue, error)

type Table

type Table struct {
	Headers []string
	LineNo  int
	// contains filtered or unexported fields
}

func TableFrom

func TableFrom(protoTable *gauge_messages.ProtoTable) *Table

func (*Table) AddHeaders added in v0.3.0

func (table *Table) AddHeaders(columnNames []string)

func (*Table) AddRowValues added in v0.3.0

func (table *Table) AddRowValues(rowValues []string)

func (*Table) Get

func (table *Table) Get(header string) []TableCell

func (*Table) GetDynamicArgs

func (table *Table) GetDynamicArgs() []string

func (*Table) GetRowCount

func (table *Table) GetRowCount() int

func (*Table) IsInitialized

func (table *Table) IsInitialized() bool

func (*Table) Kind

func (table *Table) Kind() TokenKind

func (*Table) Rows

func (table *Table) Rows() [][]string

func (*Table) String

func (table *Table) String() string

type TableCell

type TableCell struct {
	Value    string
	CellType ArgType
}

func (*TableCell) GetValue

func (cell *TableCell) GetValue() string

type Tags

type Tags struct {
	Values []string
}

func (*Tags) Kind

func (tags *Tags) Kind() TokenKind

type TearDown added in v0.3.0

type TearDown struct {
	LineNo int
	Value  string
}

func (*TearDown) Kind added in v0.3.0

func (t *TearDown) Kind() TokenKind

type Token

type Token struct {
	Kind     TokenKind
	LineNo   int
	LineText string
	Args     []string
	Value    string
}

func (*Token) String

func (token *Token) String() string

type TokenKind

type TokenKind int
const (
	SpecKind TokenKind = iota
	TagKind
	ScenarioKind
	CommentKind
	StepKind
	TableHeader
	TableRow
	HeadingKind
	TableKind
	DataTableKind
	TearDownKind
)

type Warning

type Warning struct {
	Message string
	LineNo  int
}

func (*Warning) String

func (warning *Warning) String() string

Jump to

Keyboard shortcuts

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