didPanic returns true if the function passed to it panics. Otherwise, it returns false.
(f PanicTestFunc)
| 1192 | |
| 1193 | // didPanic returns true if the function passed to it panics. Otherwise, it returns false. |
| 1194 | func didPanic(f PanicTestFunc) (didPanic bool, message interface{}, stack string) { |
| 1195 | didPanic = true |
| 1196 | |
| 1197 | defer func() { |
| 1198 | message = recover() |
| 1199 | if didPanic { |
| 1200 | stack = string(debug.Stack()) |
| 1201 | } |
| 1202 | }() |
| 1203 | |
| 1204 | // call the target function |
| 1205 | f() |
| 1206 | didPanic = false |
| 1207 | |
| 1208 | return |
| 1209 | } |
| 1210 | |
| 1211 | // Panics asserts that the code inside the specified PanicTestFunc panics. |
| 1212 | // |
no outgoing calls
searching dependent graphs…