예제 #1
0
func (filter *ScenarioFilterBasedOnTags) Filter(item parser.Item) bool {
	if item.Kind() == parser.ScenarioKind {
		tags := item.(*parser.Scenario).Tags
		if tags == nil {
			return !filter.filterTags(filter.specTags)
		}
		return !filter.filterTags(append(tags.Values, filter.specTags...))
	}
	return false
}
예제 #2
0
func (filter *scenarioIndexFilterToRetain) Filter(item parser.Item) bool {
	if item.Kind() == parser.ScenarioKind {
		if filter.currentScenarioIndex != filter.indexToNotFilter {
			filter.currentScenarioIndex++
			return true
		} else {
			filter.currentScenarioIndex++
			return false
		}
	}
	return false
}
예제 #3
0
func (executor *specExecutor) resolveToProtoItem(item parser.Item) *gauge_messages.ProtoItem {
	var protoItem *gauge_messages.ProtoItem
	switch item.Kind() {
	case parser.StepKind:
		if (item.(*parser.Step)).IsConcept {
			concept := item.(*parser.Step)
			protoItem = executor.resolveToProtoConceptItem(*concept)
		} else {
			protoItem = executor.resolveToProtoStepItem(item.(*parser.Step))
		}
		break

	default:
		protoItem = parser.ConvertToProtoItem(item)
	}
	return protoItem
}
예제 #4
0
func formatItem(item parser.Item) string {
	switch item.Kind() {
	case parser.CommentKind:
		comment := item.(*parser.Comment)
		if comment.Value == "\n" {
			return comment.Value
		}
		return fmt.Sprintf("%s\n", comment.Value)
	case parser.StepKind:
		step := item.(*parser.Step)
		return FormatStep(step)
	case parser.DataTableKind:
		dataTable := item.(*parser.DataTable)
		return FormatTable(&dataTable.Table)
	case parser.TagKind:
		tags := item.(*parser.Tags)
		return FormatTags(tags)
	}
	return ""
}