v2ray-core/testing/assert/subject.go

23 lines
464 B
Go
Raw Normal View History

package assert
type Subject struct {
2016-05-24 19:55:46 +00:00
disp string
a *Assert
}
2016-05-24 19:55:46 +00:00
func (subject *Subject) Fail(verb string, other string) {
subject.FailWithMessage("Not true that " + subject.DisplayString() + " " + verb + " <" + other + ">.")
2015-12-02 15:19:39 +00:00
}
func (subject *Subject) FailWithMessage(message string) {
2016-05-24 19:55:46 +00:00
subject.a.Fail(message)
}
2016-05-24 19:55:46 +00:00
func (subject *Subject) DisplayString() string {
value := subject.disp
if len(value) == 0 {
value = "unknown"
}
2016-05-24 19:55:46 +00:00
return "<" + value + ">"
}