You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/testing/assert/error.go

39 lines
641 B

9 years ago
package assert
8 years ago
func (v *Assert) Error(value error) *ErrorSubject {
9 years ago
valueStr := ""
if value != nil {
valueStr = value.Error()
}
return &ErrorSubject{
Subject: Subject{
8 years ago
a: v,
9 years ago
disp: valueStr,
},
value: value,
}
}
type ErrorSubject struct {
Subject
value error
}
func (subject *ErrorSubject) Equals(expectation error) {
if subject.value != expectation {
subject.Fail("is equal to", expectation.Error())
}
}
func (subject *ErrorSubject) IsNil() {
if subject.value != nil {
subject.Fail("is", "nil")
}
}
func (subject *ErrorSubject) IsNotNil() {
if subject.value == nil {
subject.Fail("is not", "nil")
}
}