mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-16 09:57:35 +08:00
feat: add length equal
This commit is contained in:
33
validate.go
33
validate.go
@@ -9,17 +9,6 @@ type stepRequestValidation struct {
|
||||
step *TStep
|
||||
}
|
||||
|
||||
func (s *stepRequestValidation) AssertEqual(jmesPath string, expected interface{}, msg string) *stepRequestValidation {
|
||||
validator := TValidator{
|
||||
Check: jmesPath,
|
||||
Assert: "equals",
|
||||
Expect: expected,
|
||||
Message: msg,
|
||||
}
|
||||
s.step.Validators = append(s.step.Validators, validator)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *stepRequestValidation) Name() string {
|
||||
return s.step.Name
|
||||
}
|
||||
@@ -31,3 +20,25 @@ func (s *stepRequestValidation) Type() string {
|
||||
func (s *stepRequestValidation) ToStruct() *TStep {
|
||||
return s.step
|
||||
}
|
||||
|
||||
func (s *stepRequestValidation) AssertEqual(jmesPath string, expected interface{}, msg string) *stepRequestValidation {
|
||||
validator := TValidator{
|
||||
Check: jmesPath,
|
||||
Assert: "equals",
|
||||
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,
|
||||
Assert: "length_equals",
|
||||
Expect: expected,
|
||||
Message: msg,
|
||||
}
|
||||
s.step.Validators = append(s.step.Validators, validator)
|
||||
return s
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user