mirror of
https://github.com/v2fly/v2ray-core
synced 2024-02-27 03:18:06 +00:00
massive refactoring against unit test lib
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package assert
|
||||
|
||||
func String(value string) *StringSubject {
|
||||
return &StringSubject{value: value}
|
||||
}
|
||||
|
||||
type StringSubject struct {
|
||||
Subject
|
||||
value string
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user