Fix runtime panics being suppressed
fatalLog was matching runtime errors, and essentially hiding them. Test: m blueprint_tools Change-Id: Ib48e7e142fc096998bc14b21fb717392adcff0ec
This commit is contained in:
@@ -196,3 +196,17 @@ func TestRecoverNonFatal(t *testing.T) {
|
||||
log.Panic("Test")
|
||||
t.Errorf("Should not get here")
|
||||
}
|
||||
|
||||
func TestRuntimePanic(t *testing.T) {
|
||||
defer func() {
|
||||
if p := recover(); p == nil {
|
||||
t.Errorf("Panic not thrown")
|
||||
}
|
||||
}()
|
||||
defer Recover(func(err error) {
|
||||
t.Errorf("Recover function should not be called")
|
||||
})
|
||||
var i *int
|
||||
*i = 0
|
||||
t.Errorf("Should not get here")
|
||||
}
|
||||
|
Reference in New Issue
Block a user