File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -228,29 +228,32 @@ func PopTester() {
228
228
return
229
229
}
230
230
231
+ var stackLvl = 5 // amount of functions before we're here
232
+ var framesToSkip = 3 // how many fn calls there is before FuncName call
233
+
231
234
var msg string
232
235
switch t := r .(type ) {
233
236
case string :
234
237
msg = t
235
238
case runtime.Error :
239
+ stackLvl -- // move stack trace cursor
240
+ framesToSkip ++ // see fatal(), skip 1 more when runtime panics
236
241
msg = t .Error ()
237
242
case error :
238
243
msg = t .Error ()
239
244
default :
240
- msg = "test panic catch"
245
+ msg = fmt . Sprintf ( " panic: %v" , t )
241
246
}
242
247
243
248
// First, print the call stack. Note that we aren't support full error
244
249
// tracing with unit test logging. However, using it has proved the top
245
250
// level error stack as more enough. Even so that we could consider using
246
251
// it for normal error stack traces if it would be possible.
247
- const stackLvl = 6 // amount of functions before we're here
248
252
debug .PrintStackForTest (os .Stderr , stackLvl )
249
253
250
254
// Now that call stack errors are printed, if any. Let's print the actual
251
255
// line that caused the error, i.e., was throwing the error. Note that we
252
256
// are here in the 'catch-function'.
253
- const framesToSkip = 4 // how many fn calls there is before FuncName call
254
257
fatal ("assertion catching: " + msg , framesToSkip )
255
258
}
256
259
You can’t perform that action at this time.
0 commit comments