本文整理匯總了Golang中github.com/getgauge/gauge/gauge_messages.TextInfo類的典型用法代碼示例。如果您正苦於以下問題:Golang TextInfo類的具體用法?Golang TextInfo怎麽用?Golang TextInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了TextInfo類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: replaceText
func replaceText(content string, info *gauge_messages.TextInfo, replacement string) string {
parts := regexp.MustCompile("\r\n|\n").Split(content, -1)
for i := info.GetStartingLineNo(); i < info.GetEndLineNo(); i++ {
parts = append(parts[:info.GetStartingLineNo()], parts[info.GetStartingLineNo()+1:]...)
}
parts[info.GetStartingLineNo()-1] = replacement
return strings.Join(parts, "\n")
}
示例2: ExtractConcept
func ExtractConcept(conceptName *gauge_messages.Step, steps []*gauge_messages.Step, conceptFileName string, changeAcrossProject bool, selectedTextInfo *gauge_messages.TextInfo) (bool, error, []string) {
content := SPEC_HEADING_TEMPLATE
if util.IsSpec(selectedTextInfo.GetFileName()) {
content, _ = common.ReadFileContents(selectedTextInfo.GetFileName())
}
concept, conceptUsageText, err := getExtractedConcept(conceptName, steps, content)
if err != nil {
return false, err, []string{}
}
writeConceptToFile(concept, conceptUsageText, conceptFileName, selectedTextInfo.GetFileName(), selectedTextInfo)
return true, errors.New(""), []string{conceptFileName, selectedTextInfo.GetFileName()}
}
示例3: ReplaceExtractedStepsWithConcept
func ReplaceExtractedStepsWithConcept(selectedTextInfo *gauge_messages.TextInfo, conceptText string) string {
content, _ := common.ReadFileContents(selectedTextInfo.GetFileName())
return replaceText(content, selectedTextInfo, conceptText)
}