didPanic returns true if the function passed to it panics. Otherwise, it returns false.
(f PanicTestFunc)
| 1278 | |
| 1279 | // didPanic returns true if the function passed to it panics. Otherwise, it returns false. |
| 1280 | func didPanic(f PanicTestFunc) (didPanic bool, message interface{}, stack string) { |
| 1281 | didPanic = true |
| 1282 | |
| 1283 | defer func() { |
| 1284 | message = recover() |
| 1285 | if didPanic { |
| 1286 | stack = string(debug.Stack()) |
| 1287 | } |
| 1288 | }() |
| 1289 | |
| 1290 | // call the target function |
| 1291 | f() |
| 1292 | didPanic = false |
| 1293 | |
| 1294 | return |
| 1295 | } |
| 1296 | |
| 1297 | // Panics asserts that the code inside the specified PanicTestFunc panics. |
| 1298 | // |
no outgoing calls
searching dependent graphs…