summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2022-07-31 13:49:57 +0100
committerGrégoire Duchêne <gduchene@awhk.org>2022-07-31 13:49:57 +0100
commitf28ee4c120a248d06ad4b09d9fea8105cb192b48 (patch)
tree028ab3a085699ad434bfa5fddd4e2c75b2099be5
parentd8366888efe8ef5626735ba5bb3774f075d7132c (diff)
Add T.Assert and T.AssertNotv0.2.0
-rw-r--r--testing.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/testing.go b/testing.go
index ba22828..40b0c42 100644
--- a/testing.go
+++ b/testing.go
@@ -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()