2015-12-02 14:27:18 +00:00
|
|
|
package assert
|
2015-09-09 15:18:29 +02:00
|
|
|
|
2015-12-02 14:27:18 +00:00
|
|
|
func String(value string) *StringSubject {
|
|
|
|
return &StringSubject{value: value}
|
2015-09-09 15:18:29 +02:00
|
|
|
}
|
|
|
|
|
2015-12-02 14:27:18 +00:00
|
|
|
type StringSubject struct {
|
|
|
|
Subject
|
|
|
|
value string
|
2015-09-09 15:18:29 +02: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)
|
|
|
|
}
|
|
|
|
}
|