cocatest/panic_assert.go

Summary

Maintainability
A
0 mins
Test Coverage
package cocatest

import "testing"

func AssertPanic(t *testing.T, panicFunc func()) {
    defer func() {
        if r := recover(); r == nil {
            t.Errorf("The code did not panic")
        }
    }()
    panicFunc()
}