Repository: stretchr/testify (Go)

Issue:
Add PanicAssertionFunc
There's already common function types for the following assertion groups:
* [`assert.BoolAssertionFunc`](https://pkg.go.dev/github.com/stretchr/testify/assert.BoolAssertionFunc)
* [`assert.ComparisonAssertionFunc`](https://pkg.go.dev/github.com/stretchr/testify/assert.ComparisonAssertionFunc)
* [`assert.ErrorAssertionFunc`](https://pkg.go.dev/github.com/stretchr/testify/assert.ErrorAssertionFunc)
* [`assert.ValueAssertionFunc`](https://pkg.go.dev/github.com/stretchr/testify/assert.ValueAssertionFunc)

These are very useful for doing table driven tests, but seems like there's no `PanicAssertionFunc`. It could look like this:
```
type PanicAssertionFunc func(t assert.TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) bool
```


Discussion:
There's a function to test whether given function panics.
```
func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool
```

This could be of your interest https://godoc.org/github.com/stretchr/testify/assert#Panics. 
Yes, that's one of the functions that will match the `PanicAssertionFunc` signature. If you look at the examples for [BoolAssertionFunc](https://godoc.org/github.com/stretchr/testify/assert#example-BoolAssertionFunc), [ComparisonAssertionFunc](https://godoc.org/github.com/stretchr/testify/assert#example-ComparisonAssertionFunc), [ErrorAssertionFunc](https://godoc.org/github.com/stretchr/testify/assert#example-ErrorAssertionFunc) and [ValueAssertionFunc](https://godoc.org/github.com/stretchr/testify/assert#example-ValueAssertionFunc), I was hoping to do something similar with [Panics](https://godoc.org/github.com/stretchr/testify/assert#Panics) and [NotPanics](https://godoc.org/github.com/stretchr/testify/assert#NotPanics) like so:

```go
package main

import "github.com/stretchr/testify/assert"
import "testing"

// This is the type I suggest adding to testify
type PanicAssertionFunc func(t assert.TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) bool

// This is an example of PanicAssertionFunc usage with table driven tests
func TestSomebodyPanic(t *testing.T) { 
  tests := map[string]struct { 
    f         func()
    assertion PanicAssertionFunc
  }{
    "panics":        {IPanic, assert.Panics},
    "no panic":      {ImOK, assert.NotPanics},
    "fail panic":    {IPanic, assert.NotPanics},
    "fail no panic": {ImOK, assert.Panics},
  } 
  for name, tt := range tests { 
    tt := tt
    t.Run(name, func(t *testing.T) { 
      tt.assertion(t, tt.f)
    })
  } 
}

// Helper functions

// IPanic always panics with a nil value
func IPanic() { 
  panic(nil)
}

// ImOK does nothing
func ImOK() {}
```

The above test will give the following output:
```
$ go test
--- FAIL: TestSomebodyPanic (0.00s)
    --- FAIL: TestSomebodyPanic/fail_no_panic (0.00s)
        main_test.go:23: 
            	Error Trace:	main_test.go:23
            	Error:      	func (assert.PanicTestFunc)(0x678310) should panic
            	            		Panic value:	<nil>
            	Test:       	TestSomebodyPanic/fail_no_panic
    --- FAIL: TestSomebodyPanic/panics (0.00s)
        main_test.go:23: 
            	Error Trace:	main_test.go:23
            	Error:      	func (assert.PanicTestFunc)(0x6782d0) should panic
            	            		Panic value:	<nil>
            	Test:       	TestSomebodyPanic/panics
FAIL
exit status 1
FAIL	test	0.003s
```
Since I find a similar concern, I have added PR https://github.com/stretchr/testify/pull/1337



Patch:
diff --git a/assert/assertions.go b/assert/assertions.go
index 0b7570f21..ccbd525d8 100644
--- a/assert/assertions.go
+++ b/assert/assertions.go
@@ -45,6 +45,10 @@ type BoolAssertionFunc func(TestingT, bool, ...interface{}) bool
 // for table driven tests.
 type ErrorAssertionFunc func(TestingT, error, ...interface{}) bool
 
+// PanicAssertionFunc is a common function prototype when validating a panic value.  Can be useful
+// for table driven tests.
+type PanicAssertionFunc = func(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool
+
 // Comparison is a custom function that returns true on success and false on failure
 type Comparison func() (success bool)
 


Test patch:
diff --git a/assert/assertions_test.go b/assert/assertions_test.go
index 2a6e47234..0ae36cd92 100644
--- a/assert/assertions_test.go
+++ b/assert/assertions_test.go
@@ -2789,6 +2789,42 @@ func TestErrorAssertionFunc(t *testing.T) {
 	}
 }
 
+func ExamplePanicAssertionFunc() {
+	t := &testing.T{} // provided by test
+
+	tests := []struct {
+		name      string
+		panicFn   PanicTestFunc
+		assertion PanicAssertionFunc
+	}{
+		{"with panic", func() { panic(nil) }, Panics},
+		{"without panic", func() {}, NotPanics},
+	}
+
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			tt.assertion(t, tt.panicFn)
+		})
+	}
+}
+
+func TestPanicAssertionFunc(t *testing.T) {
+	tests := []struct {
+		name      string
+		panicFn   PanicTestFunc
+		assertion PanicAssertionFunc
+	}{
+		{"not panic", func() {}, NotPanics},
+		{"panic", func() { panic(nil) }, Panics},
+	}
+
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			tt.assertion(t, tt.panicFn)
+		})
+	}
+}
+
 func TestEventuallyFalse(t *testing.T) {
 	mockT := new(testing.T)