From 58fb43b4866acc28f2414110338dda4a15da6407 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Wed, 22 Jun 2022 17:17:37 +0800 Subject: [PATCH] change: update unittest for regex check --- docs/CHANGELOG.md | 2 +- hrp/response_test.go | 28 +++++++++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 82caabba..b857f6fa 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -4,7 +4,7 @@ **go version** -- change: set http request timeout to 120s +- change: set http request timeout default to 120s ## v4.1.4 (2022-06-17) diff --git a/hrp/response_test.go b/hrp/response_test.go index 16aaddc8..b4ef964d 100644 --- a/hrp/response_test.go +++ b/hrp/response_test.go @@ -34,15 +34,33 @@ func TestSearchJmespath(t *testing.T) { } func TestSearchRegexp(t *testing.T) { - testText := `hrp aims to be a one-stop solution for HTTP(S) testing, covering API testing, load testing and digital experience monitoring (DEM).` + testText := ` + +` testData := []struct { raw string expected string }{ - {"covering (.*) testing,", "API"}, - {" (.*) to", "aims"}, - {"^(.*) aims", "hrp"}, - {".* (.*?)$", "(DEM)."}, + {"/user/signOut\">(.*)", "Sign Out"}, + {"
  • ", "Leo"}, } // new response object resp := http.Response{}