提交 201c7317 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

stdin

上级 929fd22b
......@@ -7,7 +7,7 @@ import (
func CommitCases(files []string) {
for _, file := range files {
id, _, title := zentaoUtils.GetCaseInfo(file)
_, id, _, title := zentaoUtils.GetCaseInfo(file)
zentaoService.CommitCase(id, title)
}
}
......@@ -25,10 +25,10 @@ func GetAllScriptsInDir(filePth string, files *[]string) error {
pass, _ := regexp.MatchString("^*.\\."+regx+"$", filePth)
if pass {
//id, _, _ := zentaoUtils.GetCaseInfo(filePth)
//if id > 0 {
*files = append(*files, filePth)
//}
pass := zentaoUtils.CheckFileIsScript(filePth)
if pass {
*files = append(*files, filePth)
}
}
return nil
......@@ -53,10 +53,10 @@ func GetAllScriptsInDir(filePth string, files *[]string) error {
pass, _ := regexp.MatchString("^*.\\."+regx+"$", path)
if pass {
//id, _, _ := zentaoUtils.GetCaseInfo(path)
//if id > 0 {
*files = append(*files, path)
//}
pass := zentaoUtils.CheckFileIsScript(filePth)
if pass {
*files = append(*files, path)
}
}
}
}
......@@ -91,14 +91,15 @@ func GetScriptByIdsInDir(dirPth string, idMap map[int]string, files *[]string) e
}
path := dirPth + name
id, _, _ := zentaoUtils.GetCaseInfo(path)
//if id > 0 {
_, ok := idMap[id]
if ok {
*files = append(*files, path)
pass, id, _, _ := zentaoUtils.GetCaseInfo(path)
if pass {
_, ok := idMap[id]
if ok {
*files = append(*files, path)
}
}
//}
}
}
......
......@@ -27,7 +27,7 @@ func ValidateCaseResult(scriptFile string, langType string,
checkpointStepArr []string, expectArr [][]string, skip bool, actualArr [][]string, report *model.TestReport,
idx int, total int) {
caseId, productId, title := zentaoUtils.GetCaseInfo(scriptFile)
_, caseId, productId, title := zentaoUtils.GetCaseInfo(scriptFile)
stepLogs := make([]model.StepLog, 0)
caseResult := constant.PASS.String()
......
......@@ -30,10 +30,10 @@ func InputForCheckout(productId *string, moduleId *string, suiteId *string, task
productCheck = "*"
numb = "1"
} else if *suiteId != "" {
moduleCheck = "*"
suiteCheck = "*"
numb = "3"
} else if *taskId != "" {
moduleCheck = "*"
taskCheck = "*"
numb = "4"
}
......@@ -41,22 +41,22 @@ func InputForCheckout(productId *string, moduleId *string, suiteId *string, task
coType = strings.ToLower(coType)
if coType == "1" {
*productId = GetInput("\\d+", "",
i118Utils.I118Prt.Sprintf("pls_enter")+" "+i118Utils.I118Prt.Sprintf("product_id"))
*productId = GetInput("\\d+", *productId,
i118Utils.I118Prt.Sprintf("pls_enter")+" "+i118Utils.I118Prt.Sprintf("product_id")+": "+*productId)
} else if coType == "2" {
*productId = GetInput("\\d+", "",
i118Utils.I118Prt.Sprintf("pls_enter")+" "+i118Utils.I118Prt.Sprintf("product_id"))
*productId = GetInput("\\d+", *productId,
i118Utils.I118Prt.Sprintf("pls_enter")+" "+i118Utils.I118Prt.Sprintf("product_id")+": "+*productId)
*moduleId = GetInput("\\d+", "",
i118Utils.I118Prt.Sprintf("pls_enter")+" "+i118Utils.I118Prt.Sprintf("module_id"))
*moduleId = GetInput("\\d+", *moduleId,
i118Utils.I118Prt.Sprintf("pls_enter")+" "+i118Utils.I118Prt.Sprintf("module_id")+": "+*moduleId)
} else if coType == "3" {
*suiteId = GetInput("\\d+", "",
i118Utils.I118Prt.Sprintf("pls_enter")+" "+i118Utils.I118Prt.Sprintf("suite_id"))
*suiteId = GetInput("\\d+", *suiteId,
i118Utils.I118Prt.Sprintf("pls_enter")+" "+i118Utils.I118Prt.Sprintf("suite_id")+": "+*suiteId)
} else if coType == "4" {
*taskId = GetInput("\\d+", "",
i118Utils.I118Prt.Sprintf("pls_enter")+" "+i118Utils.I118Prt.Sprintf("task_id"))
*taskId = GetInput("\\d+", *taskId,
i118Utils.I118Prt.Sprintf("pls_enter")+" "+i118Utils.I118Prt.Sprintf("task_id")+": "+*taskId)
}
InputForBool(independentFile, false, "enter_co_independent")
......
......@@ -81,7 +81,7 @@ func RunDateFolder() string {
return runName
}
func GetCaseInfo(file string) (int, int, string) {
func GetCaseInfo(file string) (bool, int, int, string) {
var caseId int
var productId int
var title string
......@@ -90,7 +90,7 @@ func GetCaseInfo(file string) (int, int, string) {
pass := CheckFileContentIsScript(content)
if !pass {
return caseId, productId, title
return false, caseId, productId, title
}
myExp := regexp.MustCompile(`[\S\s]*caseId:\s*([^\n]*?)\s*\n`)
......@@ -111,7 +111,7 @@ func GetCaseInfo(file string) (int, int, string) {
title = arr[1]
}
return caseId, productId, title
return pass, caseId, productId, title
}
func ReadExpect(file string) [][]string {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册