From 19641031046294fb0e18e645b8cf5cf8fd729e2e Mon Sep 17 00:00:00 2001 From: xucong053 Date: Tue, 12 Apr 2022 11:48:46 +0800 Subject: [PATCH] fix: deal with extract expr including hyphen --- hrp/step_api.go | 1 + hrp/testcase.go | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/hrp/step_api.go b/hrp/step_api.go index d74406f3..292a616f 100644 --- a/hrp/step_api.go +++ b/hrp/step_api.go @@ -48,6 +48,7 @@ func (path *APIPath) ToAPI() (*API, error) { return nil, err } err = convertCompatValidator(api.Validators) + convertExtract(api.Extract) return api, err } diff --git a/hrp/testcase.go b/hrp/testcase.go index 79922338..a77059a4 100644 --- a/hrp/testcase.go +++ b/hrp/testcase.go @@ -170,6 +170,9 @@ func (tc *TCase) makeCompat() error { if err != nil { return err } + + // 3. deal with extract expr including hyphen + convertExtract(step.Extract) } return nil } @@ -212,6 +215,13 @@ func convertCompatValidator(Validators []interface{}) (err error) { return nil } +// convertExtract deals with extract expr including hyphen +func convertExtract(extract map[string]string) { + for key, value := range extract { + extract[key] = convertCheckExpr(value) + } +} + // convertCheckExpr deals with check expression including hyphen func convertCheckExpr(checkExpr string) string { if strings.Contains(checkExpr, textExtractorSubRegexp) {