Esempio n. 1
0
func AddConcepts(conceptFile string, conceptDictionary *gauge.ConceptDictionary) *ParseError {
	concepts, parseResults := new(ConceptParser).ParseFile(conceptFile)
	if parseResults != nil && parseResults.Warnings != nil {
		for _, warning := range parseResults.Warnings {
			logger.Warning(warning.String())
		}
	}
	if parseResults != nil && parseResults.Error != nil {
		return parseResults.Error
	}
	for _, conceptStep := range concepts {
		if _, exists := conceptDictionary.ConceptsMap[conceptStep.Value]; exists {
			return &ParseError{Message: "Duplicate concept definition found", LineNo: conceptStep.LineNo, LineText: conceptStep.LineText}
		}
		conceptDictionary.ReplaceNestedConceptSteps(conceptStep)
		conceptDictionary.ConceptsMap[conceptStep.Value] = &gauge.Concept{conceptStep, conceptFile}
	}
	conceptDictionary.UpdateLookupForNestedConcepts()
	return validateConcepts(conceptDictionary)
}