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

rename method for old script format

上级 c5e9ef30
......@@ -20,7 +20,7 @@ func CommitCases(files []string) {
isIndependent, expectIndependentContent := zentaoUtils.GetDependentExpect(cs)
if isIndependent {
expectMap = scriptUtils.GetExpectMapFromIndependentFile(expectMap, expectIndependentContent, true)
expectMap = scriptUtils.GetExpectMapFromIndependentFileObsolete(expectMap, expectIndependentContent, true)
}
zentaoService.CommitCase(id, title, stepMap, stepTypeMap, expectMap)
......
......@@ -22,18 +22,18 @@ func CheckCaseResult(file string, logs string, report *model.TestReport, idx int
isIndependent, expectIndependentContent := zentaoUtils.GetDependentExpect(file)
if isIndependent {
if isOldFormat {
expectMap = scriptUtils.GetExpectMapFromIndependentFile(expectMap, expectIndependentContent, false)
expectMap = scriptUtils.GetExpectMapFromIndependentFileObsolete(expectMap, expectIndependentContent, false)
} else {
expectMap = scriptUtils.GetExpectMapFromIndependentFileNew(expectMap, expectIndependentContent, false)
expectMap = scriptUtils.GetExpectMapFromIndependentFile(expectMap, expectIndependentContent, false)
}
}
skip := false
actualArr := make([][]string, 0)
if isOldFormat {
skip, actualArr = zentaoUtils.ReadLogArr(logs)
skip, actualArr = zentaoUtils.ReadLogArrObsolete(logs)
} else {
skip, actualArr = zentaoUtils.ReadLogArrNew(logs)
skip, actualArr = zentaoUtils.ReadLogArr(logs)
}
language := langUtils.GetLangByFile(file)
......
......@@ -25,11 +25,11 @@ func GetStepAndExpectMap(file string) (stepMap, stepTypeMap, expectMap maps.Map,
if isOldFormat {
groupBlockArr := getGroupBlockArr(lines)
groupArr := getStepNestedArr(groupBlockArr)
_, stepMap, stepTypeMap, expectMap = getSortedTextFromNestedSteps(groupArr)
groupArr := getStepNestedArrObsolete(groupBlockArr)
_, stepMap, stepTypeMap, expectMap = getSortedTextFromNestedStepsObsolete(groupArr)
} else {
groupArr := getStepNestedArrNew(lines)
_, stepMap, stepTypeMap, expectMap = getSortedTextFromNestedStepsNew(groupArr)
groupArr := getStepNestedArr(lines)
_, stepMap, stepTypeMap, expectMap = getSortedTextFromNestedSteps(groupArr)
}
return
......@@ -49,8 +49,8 @@ func SortFile(file string) {
lines := strings.Split(content, "\n")
groupBlockArr := getGroupBlockArr(lines)
groupArr := getStepNestedArr(groupBlockArr)
stepsTxt, _, _, _ = getSortedTextFromNestedSteps(groupArr)
groupArr := getStepNestedArrObsolete(groupBlockArr)
stepsTxt, _, _, _ = getSortedTextFromNestedStepsObsolete(groupArr)
// replace info
from := ""
......@@ -112,7 +112,7 @@ func getGroupBlockArr(lines []string) [][]string {
return groupBlockArr
}
func getStepNestedArr(blocks [][]string) []model.TestStep {
func getStepNestedArrObsolete(blocks [][]string) []model.TestStep {
ret := make([]model.TestStep, 0)
for _, block := range blocks {
......@@ -136,7 +136,7 @@ func getStepNestedArr(blocks [][]string) []model.TestStep {
return ret
}
func getStepNestedArrNew(lines []string) (ret []model.TestStep) {
func getStepNestedArr(lines []string) (ret []model.TestStep) {
parent := model.TestStep{}
increase := 0
for index := 0; index < len(lines); index++ {
......@@ -311,7 +311,7 @@ func isGroup(str string) bool {
return ret
}
func getSortedTextFromNestedSteps(groups []model.TestStep) (string, maps.Map, maps.Map, maps.Map) {
func getSortedTextFromNestedStepsObsolete(groups []model.TestStep) (string, maps.Map, maps.Map, maps.Map) {
ret := make([]string, 0)
stepMap := linkedhashmap.New()
stepTypeMap := linkedhashmap.New()
......@@ -420,7 +420,7 @@ func getSortedTextFromNestedSteps(groups []model.TestStep) (string, maps.Map, ma
return strings.Join(ret, "\n"), stepMap, stepTypeMap, expectMap
}
func getSortedTextFromNestedStepsNew(groups []model.TestStep) (ret string, stepMap, stepTypeMap, expectMap maps.Map) {
func getSortedTextFromNestedSteps(groups []model.TestStep) (ret string, stepMap, stepTypeMap, expectMap maps.Map) {
arr := make([]string, 0)
stepMap = linkedhashmap.New()
stepTypeMap = linkedhashmap.New()
......@@ -514,10 +514,10 @@ func printMutiStepOrExpect(str string) string {
return strings.Join(ret, "\r\n")
}
func GetExpectMapFromIndependentFile(expectMap maps.Map, content string, withEmptyExpect bool) maps.Map {
func GetExpectMapFromIndependentFileObsolete(expectMap maps.Map, content string, withEmptyExpect bool) maps.Map {
retMap := linkedhashmap.New()
expectArr := zentaoUtils.ReadExpectIndependentArr(content)
expectArr := zentaoUtils.ReadExpectIndependentArrObsolete(content)
idx := 0
for _, keyIfs := range expectMap.Keys() {
......@@ -539,10 +539,10 @@ func GetExpectMapFromIndependentFile(expectMap maps.Map, content string, withEmp
return retMap
}
func GetExpectMapFromIndependentFileNew(expectMap maps.Map, content string, withEmptyExpect bool) maps.Map {
func GetExpectMapFromIndependentFile(expectMap maps.Map, content string, withEmptyExpect bool) maps.Map {
retMap := linkedhashmap.New()
expectArr := zentaoUtils.ReadExpectIndependentArrNew(content)
expectArr := zentaoUtils.ReadExpectIndependentArr(content)
idx := 0
for _, keyIfs := range expectMap.Keys() {
......
......@@ -175,13 +175,13 @@ func GetCaseInfo(file string) (bool, int, int, string) {
// }
//
// if independentExpect {
// expectArr = ReadExpectIndependentArr(expectIndependentContent)
// expectArr = ReadExpectIndependentArrObsolete(expectIndependentContent)
// }
//
// return cpStepArr, expectArr
//}
func ReadExpectIndependentArr(content string) [][]string {
func ReadExpectIndependentArrObsolete(content string) [][]string {
lines := strings.Split(content, "\n")
ret := make([][]string, 0)
......@@ -212,7 +212,7 @@ func ReadExpectIndependentArr(content string) [][]string {
return ret
}
func ReadExpectIndependentArrNew(content string) [][]string {
func ReadExpectIndependentArr(content string) [][]string {
lines := strings.Split(content, "\n")
ret := make([][]string, 0)
......@@ -252,7 +252,7 @@ func ReadExpectIndependentArrNew(content string) [][]string {
return ret
}
func ReadLogArr(content string) (isSkip bool, ret [][]string) {
func ReadLogArrObsolete(content string) (isSkip bool, ret [][]string) {
lines := strings.Split(content, "\n")
ret = make([][]string, 0)
......@@ -297,7 +297,7 @@ func ReadLogArr(content string) (isSkip bool, ret [][]string) {
return
}
func ReadLogArrNew(content string) (isSkip bool, ret [][]string) {
func ReadLogArr(content string) (isSkip bool, ret [][]string) {
lines := strings.Split(content, "\n")
ret = make([][]string, 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册