|
|
@ -4,6 +4,7 @@ import (
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Assert on a boolean variable.
|
|
|
|
func Bool(value bool) *BoolSubject {
|
|
|
|
func Bool(value bool) *BoolSubject {
|
|
|
|
return &BoolSubject{value: value}
|
|
|
|
return &BoolSubject{value: value}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -26,18 +27,21 @@ func (subject *BoolSubject) DisplayString() string {
|
|
|
|
return subject.Subject.DisplayString(strconv.FormatBool(subject.value))
|
|
|
|
return subject.Subject.DisplayString(strconv.FormatBool(subject.value))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// to be equal to another boolean variable.
|
|
|
|
func (subject *BoolSubject) Equals(expectation bool) {
|
|
|
|
func (subject *BoolSubject) Equals(expectation bool) {
|
|
|
|
if subject.value != expectation {
|
|
|
|
if subject.value != expectation {
|
|
|
|
subject.Fail("is equal to", expectation)
|
|
|
|
subject.Fail("is equal to", expectation)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// to be true.
|
|
|
|
func (subject *BoolSubject) IsTrue() {
|
|
|
|
func (subject *BoolSubject) IsTrue() {
|
|
|
|
if subject.value != true {
|
|
|
|
if subject.value != true {
|
|
|
|
subject.Fail("is", true)
|
|
|
|
subject.Fail("is", true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// to be false.
|
|
|
|
func (subject *BoolSubject) IsFalse() {
|
|
|
|
func (subject *BoolSubject) IsFalse() {
|
|
|
|
if subject.value != false {
|
|
|
|
if subject.value != false {
|
|
|
|
subject.Fail("is", false)
|
|
|
|
subject.Fail("is", false)
|
|
|
|