1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-10-03 17:23:43 -04:00
v2fly/testing/assert/subject.go
2015-12-02 14:27:18 +00:00

34 lines
545 B
Go

package assert
import (
v2testing "github.com/v2ray/v2ray-core/testing"
)
type Subject struct {
name string
}
func NewSubject() *Subject {
return &Subject{
name: "",
}
}
func (subject *Subject) FailWithMessage(message string) {
v2testing.Fail(message)
}
func (subject *Subject) Named(name string) {
subject.name = name
}
func (subject *Subject) DisplayString(value string) string {
if len(value) == 0 {
value = "unknown"
}
if len(subject.name) == 0 {
return "<" + value + ">"
}
return subject.name + "(<" + value + ">)"
}