IsTrue succeeds if boolean is true. Example: boolean := NewBoolean(t, true) boolean.IsTrue()
()
| 110 | // boolean := NewBoolean(t, true) |
| 111 | // boolean.IsTrue() |
| 112 | func (b *Boolean) IsTrue() *Boolean { |
| 113 | opChain := b.chain.enter("IsTrue()") |
| 114 | defer opChain.leave() |
| 115 | |
| 116 | if opChain.failed() { |
| 117 | return b |
| 118 | } |
| 119 | |
| 120 | if !(b.value == true) { |
| 121 | opChain.fail(AssertionFailure{ |
| 122 | Type: AssertEqual, |
| 123 | Actual: &AssertionValue{b.value}, |
| 124 | Expected: &AssertionValue{true}, |
| 125 | Errors: []error{ |
| 126 | errors.New("expected: boolean is true"), |
| 127 | }, |
| 128 | }) |
| 129 | } |
| 130 | |
| 131 | return b |
| 132 | } |
| 133 | |
| 134 | // IsFalse succeeds if boolean is false. |
| 135 | // |