diff --git a/demo/t/9_new_format.php b/demo/t/9_new_format.php index d26f55770d229d58dc452b54e69e443e8cc5b924..fea3202e6c26442022e6b46dde72ec68923c74a1 100755 --- a/demo/t/9_new_format.php +++ b/demo/t/9_new_format.php @@ -11,10 +11,7 @@ 期待结果2.1-2 } - - 子步骤2.2 @{ - 期待结果2.2-1 - 期待结果2.2-2 - } + - 子步骤2.2 @期待结果2.2 - 步骤3 - 步骤4 @期待结果3 */ @@ -22,8 +19,8 @@ print("@期待结果1\n"); print("@{\n"); -print("期待结果2.1.1\n"); -print("期待结果2.1.2\n"); +print("期待结果2.1-1\n"); +print("期待结果2.1-2\n"); print("}\n"); print("@期待结果2.2\n"); diff --git a/internal/pkg/helper/script/generator.go b/internal/pkg/helper/script/generator.go index 6dd1120c65968907a47c4f0debcf4d3e6514f904..9111512047bd84880a89846c236bc0348f7bf536 100644 --- a/internal/pkg/helper/script/generator.go +++ b/internal/pkg/helper/script/generator.go @@ -192,8 +192,8 @@ func getCaseStepContent(stepObj commDomain.ZtfStep, seq string, independentFile stepContent = stepStr + expectStr } else { stepContent = stepStr - if stepObj.Children == nil || len(stepObj.Children) == 0 { - stepContent += " >>" + if (stepObj.Children == nil || len(stepObj.Children) == 0) && expectStr != "" { + stepContent += " @" } } diff --git a/internal/pkg/helper/script/parser.go b/internal/pkg/helper/script/parser.go index 61c2dc0c54d64ab5cb432205f4ce259da1327169..4fa12c8627391ea83e960a32537dbb921640997a 100644 --- a/internal/pkg/helper/script/parser.go +++ b/internal/pkg/helper/script/parser.go @@ -553,13 +553,14 @@ func ReadLogArr(content string) (isSkip bool, ret [][]string) { return } - if line == ">>" { // more than one line + if line == "@{" { // more than one line model = "multi" cpArr = make([]string, 0) - } else if model == "multi" { // in >> and >> in multi line mode + } else if model == "multi" { // between line @{ and } in multi line mode cpArr = append(cpArr, line) - if idx == len(lines)-1 || strings.Index(lines[idx+1], ">>") > -1 { + //if idx == len(lines)-1 || strings.Index(lines[idx+1], "}") > -1 { + if idx == len(lines)-1 || strings.TrimSpace(lines[idx+1]) == "}" { temp := make([]string, 0) temp = append(temp, cpArr...) @@ -573,6 +574,11 @@ func ReadLogArr(content string) (isSkip bool, ret [][]string) { model = "single" line = strings.TrimSpace(line) + if strings.Index(line, "@") != 0 { // ignore the line not started with @ + continue + } + + line = line[1:] cpArr = append(cpArr, line) ret = append(ret, cpArr)