Exemplo n.º 1
0
func getContentWithDataTable(content string) (string, error) {
	spec, result := new(parser.SpecParser).Parse(content, &parser.ConceptDictionary{})
	if !result.Ok {
		return "", fmt.Errorf("Spec Parse failure: %s", result.ParseError)
	}
	newSpec := &parser.Specification{Heading: &parser.Heading{Value: "SPECHEADING"}}
	if spec.DataTable.IsInitialized() {
		newSpec = &parser.Specification{Items: []parser.Item{&spec.DataTable}, Heading: &parser.Heading{Value: "SPECHEADING"}}
	}
	return formatter.FormatSpecification(newSpec) + "\n##hello \n* step \n", nil
}
Exemplo n.º 2
0
func writeToConceptAndSpecFiles(specs []*parser.Specification, conceptDictionary *parser.ConceptDictionary, specsRefactored map[*parser.Specification]bool, conceptFilesRefactored map[string]bool) ([]string, []string) {
	specFiles := make([]string, 0)
	conceptFiles := make([]string, 0)
	for _, spec := range specs {
		if specsRefactored[spec] {
			specFiles = append(specFiles, spec.FileName)
			formatted := formatter.FormatSpecification(spec)
			util.SaveFile(spec.FileName, formatted, true)
		}
	}
	conceptMap := formatter.FormatConcepts(conceptDictionary)
	for fileName, concept := range conceptMap {
		if conceptFilesRefactored[fileName] {
			conceptFiles = append(conceptFiles, fileName)
			util.SaveFile(fileName, concept, true)
		}
	}
	return specFiles, conceptFiles
}