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

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