aboutsummaryrefslogtreecommitdiffstats
path: root/assert_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'assert_test.go')
-rw-r--r--assert_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/assert_test.go b/assert_test.go
index 27f73eb..59645a6 100644
--- a/assert_test.go
+++ b/assert_test.go
@@ -27,6 +27,30 @@ func (m *MockT) Log(args ...any) {
m.Logs = append(m.Logs, fmt.Sprint(args...))
}
+func TestCheck(t *testing.T) {
+ t.Run("True", func(t *testing.T) {
+ mockT := &MockT{}
+ Check(mockT, true)
+ if mockT.FailNowCalled {
+ t.Fatal("Check should not be failing any tests")
+ }
+ if len(mockT.Logs) > 0 {
+ t.Fatal("Check should not emit any logs on success")
+ }
+ })
+
+ t.Run("False", func(t *testing.T) {
+ mockT := &MockT{}
+ Check(mockT, false)
+ if mockT.FailNowCalled {
+ t.Fatal("Check should not be failing any tests")
+ }
+ if len(mockT.Logs) == 0 {
+ t.Fatal("Check should be emiting a logs on failure")
+ }
+ })
+}
+
func TestAssert(t *testing.T) {
t.Run("True", func(t *testing.T) {
mockT := &MockT{}
@@ -42,6 +66,9 @@ func TestAssert(t *testing.T) {
if !mockT.FailNowCalled {
t.Fatal("Assert passed when it should have failed")
}
+ if len(mockT.Logs) == 0 {
+ t.Fatal("Assert should have emitted a failure log")
+ }
})
}