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