From e82714a0f7bf6baf81c8c203c45e90b6a8904b71 Mon Sep 17 00:00:00 2001 From: Aaron Chen <462826@qq.com> Date: Thu, 8 Aug 2019 13:19:21 +0800 Subject: [PATCH] fix regx issue in windows --- result.txt | 20 ++++++++++++++++++++ src/test.go | 15 ++------------- 2 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 result.txt diff --git a/result.txt b/result.txt new file mode 100644 index 00000000..3ea695fa --- /dev/null +++ b/result.txt @@ -0,0 +1,20 @@ +Run scripts in folder 'C:\Users\aaron\zentaoatf\' on windows OS +From 2019-08-08 13:14:22 to 2019-08-08 13:14:22, spend 0 secs +Total: 2 + Pass: 1 + Fail: 1 + Skip: 0 + + PASS scripts\tc-100.py + No checkpoints + + FAIL scripts\tc-200.py + Step1: FAIL @step2010 第4次尝试登录 + Checkpoint1: FAIL + Expect Result CODE: @step2010期望结果, 可以有多行 + Actual Result N/A + + Step2: FAIL @step2104 再输入1次正确的密码 + Checkpoint1: FAIL + Expect Result CODE: @step2104期望结果, 可以有多行 + Actual Result N/A \ No newline at end of file diff --git a/src/test.go b/src/test.go index 2416a7b5..7c79139f 100644 --- a/src/test.go +++ b/src/test.go @@ -2,23 +2,12 @@ package main import ( "fmt" + "github.com/easysoft/zentaoatf/src/utils" "regexp" ) func main() { - text := ` df - FAIL scripts\tc-200.py - Step1: FAIL @step2010 第4次尝试登录 - Checkpoint1: FAIL - Expect Result CODE: @step2010期望结果, 可以有多行 - Actual Result N/A - - Step2: FAIL @step2104 再输入1次正确的密码 - Checkpoint1: FAIL - Expect Result CODE: @step2104期望结果, 可以有多行 - Actual Result N/A - -dd` + text := utils.ReadFile("result.txt") str := "(?m:^\\s" + "FAIL\\sscripts\\\\tc-200.py" + "\\n([\\s\\S]*?)((^\\s(PASS|FAIL))|\\z))" // myExp := regexp.MustCompile("(?m:^\\s(?:PASS|FAIL) scripts\\tc-200.py\n([\\s\\S]*?)((^\\s(PASS|FAIL))|\\z))") -- GitLab