1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-01 19:45:24 +00:00
v2fly/testing/unit/stringsubject.go

33 lines
740 B
Go
Raw Normal View History

2015-09-09 13:18:29 +00:00
package unit
type StringSubject struct {
*Subject
value string
}
func NewStringSubject(base *Subject, value string) *StringSubject {
2015-09-20 11:08:05 +00:00
return &StringSubject{
Subject: base,
value: value,
}
2015-09-09 13:18:29 +00:00
}
func (subject *StringSubject) Named(name string) *StringSubject {
subject.Subject.Named(name)
return subject
}
func (subject *StringSubject) Fail(verb string, other string) {
subject.FailWithMessage("Not true that " + subject.DisplayString() + " " + verb + " <" + other + ">.")
}
func (subject *StringSubject) DisplayString() string {
return subject.Subject.DisplayString(subject.value)
}
func (subject *StringSubject) Equals(expectation string) {
if subject.value != expectation {
subject.Fail("is equal to", expectation)
}
}