diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2022-07-31 13:49:57 +0100 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2022-07-31 13:49:57 +0100 |
| commit | f28ee4c120a248d06ad4b09d9fea8105cb192b48 (patch) | |
| tree | 028ab3a085699ad434bfa5fddd4e2c75b2099be5 | |
| parent | d8366888efe8ef5626735ba5bb3774f075d7132c (diff) | |
Add T.Assert and T.AssertNotv0.2.0
| -rw-r--r-- | testing.go | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -20,6 +20,15 @@ type T struct { wg sync.WaitGroup } +func (t *T) Assert(b bool) bool { + t.Helper() + + if !b { + t.Error("\nexepected value to be true") + } + return b +} + func (t *T) AssertEqual(exp, actual any) bool { t.Helper() @@ -67,6 +76,15 @@ func (t *T) AssertPanicsWith(f func(), exp any) (b bool) { return true } +func (t *T) AssertNot(b bool) bool { + t.Helper() + + if b { + t.Error("\nexpected value to be false") + } + return !b +} + func (t *T) AssertNotEqual(notExp, actual any) bool { t.Helper() |
