mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-03 06:49:38 +08:00
feat: assert with startswith and endswith for string
This commit is contained in:
22
validate.go
22
validate.go
@@ -32,6 +32,28 @@ func (s *stepRequestValidation) AssertEqual(jmesPath string, expected interface{
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *stepRequestValidation) AssertStartsWith(jmesPath string, expected interface{}, msg string) *stepRequestValidation {
|
||||
validator := TValidator{
|
||||
Check: jmesPath,
|
||||
Assert: "startswith",
|
||||
Expect: expected,
|
||||
Message: msg,
|
||||
}
|
||||
s.step.Validators = append(s.step.Validators, validator)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *stepRequestValidation) AssertEndsWith(jmesPath string, expected interface{}, msg string) *stepRequestValidation {
|
||||
validator := TValidator{
|
||||
Check: jmesPath,
|
||||
Assert: "endswith",
|
||||
Expect: expected,
|
||||
Message: msg,
|
||||
}
|
||||
s.step.Validators = append(s.step.Validators, validator)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *stepRequestValidation) AssertLengthEqual(jmesPath string, expected interface{}, msg string) *stepRequestValidation {
|
||||
validator := TValidator{
|
||||
Check: jmesPath,
|
||||
|
||||
Reference in New Issue
Block a user