diff --git a/demo/sample/1_simple.sh b/demo/sample/1_simple.sh deleted file mode 100755 index 804cdeb8..00000000 --- a/demo/sample/1_simple.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -:<> expect 1 -step2 >> -step3 >> expect 3 - -! - - -echo "expect 1" -echo "pass" -echo "expect 3" -echo "it is stderr msg" diff --git a/internal/pkg/helper/script/parser.go b/internal/pkg/helper/script/parser.go index 5beaa26a..918b44ab 100644 --- a/internal/pkg/helper/script/parser.go +++ b/internal/pkg/helper/script/parser.go @@ -105,7 +105,7 @@ func ReadTitleAndStepsInNewFormat(content, lang string) (caseId int, title strin } func getSingleExpect(descAndExpect string) (desc, expect string) { - arr := strings.Split(descAndExpect, "@") + arr := strings.SplitN(descAndExpect, "@", 2) desc = strings.TrimSpace(arr[0]) if len(arr) > 1 { @@ -114,7 +114,6 @@ func getSingleExpect(descAndExpect string) (desc, expect string) { expect = "pass" } } - return } @@ -150,6 +149,12 @@ func getMultiExpect(lines []string, index *int) (ret string) { return } +// isStepLine +/* +- 步骤1 # true 步骤1 false + - 子步骤1.1 # true 子步骤1.1 true +- 步骤2 # true 步骤2 false +*/ func isStepLine(line string) (is bool, ret string, isChild bool) { reg := `^(\s*)-\s*(.+)$` arr := regexp.MustCompile(reg).FindStringSubmatch(line)