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

fix issue of exec the case with independent expect results

上级 1eef442e
期待结果1
期待结果2.1
{
期待结果2.2-1
期待结果2.2-2
}
期待结果3
\ No newline at end of file
#!/usr/bin/env php
<?php
/**
title=测试用例标题
cid=2
- 步骤1 @
- 步骤2
- 子步骤2.1 @
- 子步骤2.2 @
- 步骤3
- 步骤4 @
*/
print("@期待结果1\n");
print("@期待结果2.1\n");
print("@{\n");
print("期待结果2.2-1\n");
print("期待结果2.2-2\n");
print("}\n");
print("@期待结果3\n");
?>
\ No newline at end of file
......@@ -248,7 +248,7 @@ func getExpectContent(str string, isChild bool, independentFile bool) (ret strin
// expect 1.2 line 1
// expect 1.2 line 2
//>>
ret = "@{\n" + space + strings.ReplaceAll(str, rpl, rpl+space) + "\n}"
ret = "{\n" + space + strings.ReplaceAll(str, rpl, rpl+space) + "\n}"
} else {
//step 1.2 @{
// expect 1.2 line 1
......
......@@ -98,7 +98,10 @@ func getSingleExpect(descAndExpect string) (desc, expect string) {
desc = strings.TrimSpace(arr[0])
if len(arr) > 1 {
expect = arr[1]
expect = strings.TrimSpace(arr[1])
if expect == "" {
expect = "pass"
}
}
return
......@@ -185,7 +188,7 @@ func ReadCaseInfoInOldFormat(content, lang string) (info, checkpoints string) {
func GetStepAndExpectMapInOldFormat(checkpoints, file string) (steps []commDomain.ZentaoCaseStep) {
lines := strings.Split(checkpoints, "\n")
groupArr := getStepNestedArr(lines)
groupArr := getStepNestedArrInOldFormat(lines)
_, steps = getSortedTextFromNestedSteps(groupArr)
isIndependent, expectIndependentContent := GetDependentExpect(file)
......@@ -225,7 +228,7 @@ func GetDependentExpect(file string) (bool, string) {
return false, ""
}
func getStepNestedArr(lines []string) (ret []commDomain.ZtfStep) {
func getStepNestedArrInOldFormat(lines []string) (ret []commDomain.ZtfStep) {
parent := commDomain.ZtfStep{}
increase := 0
for index := 0; index < len(lines); index++ {
......@@ -487,14 +490,14 @@ func GetCaseInfo(file string) (pass bool, caseId, productId int, title string, t
func ReadExpectIndependentArr(content string) [][]string {
//正常显示6
//E2.16
//>>
//{
// E2.2 - 16
// E2.2 - 26
//>>
//>>
//}
//{
// E3 - 16
// E3 - 26
//>>
//}
lines := strings.Split(content, "\n")
......@@ -506,13 +509,13 @@ func ReadExpectIndependentArr(content string) [][]string {
for idx < len(lines) {
line := strings.TrimSpace(lines[idx])
if line == ">>" { // more than one line
if line == "{" { // more than one line
currModel = "multi"
cpArr = make([]string, 0)
} else if currModel == "multi" { // in >> and >> in multi line mode
} else if currModel == "multi" { // in { and } in multi line mode
cpArr = append(cpArr, line)
if idx == len(lines)-1 || strings.Index(lines[idx+1], ">>") > -1 { // end multi line
if idx == len(lines)-1 || strings.TrimSpace(lines[idx+1]) == "}" { // end multi line
temp := make([]string, 0)
temp = append(temp, strings.Join(cpArr, "\r\n"))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册