Example #1
0
func createConceptStep(spec *gauge.Specification, concept *gauge.Step, originalStep *gauge.Step) {
	stepCopy := concept.GetCopy()
	originalArgs := originalStep.Args
	originalStep.CopyFrom(stepCopy)
	originalStep.Args = originalArgs

	// set parent of all concept steps to be the current concept (referred as originalStep here)
	// this is used to fetch from parent's lookup when nested
	for _, conceptStep := range originalStep.ConceptSteps {
		conceptStep.Parent = originalStep
	}

	spec.PopulateConceptLookup(&originalStep.Lookup, concept.Args, originalStep.Args)
}
Example #2
0
func FormatSpecification(specification *gauge.Specification) string {
	var formattedSpec bytes.Buffer
	formatter := &formatter{buffer: formattedSpec}
	specification.Traverse(formatter)
	return string(formatter.buffer.Bytes())
}