mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
add panic log
This commit is contained in:
parent
8bad1bbfc2
commit
be62c3ce27
1 changed files with 7 additions and 3 deletions
|
|
@ -46,7 +46,9 @@ func TestClosableMutex_Unlock(t *testing.T) {
|
||||||
cm.MustLock()
|
cm.MustLock()
|
||||||
cm.Unlock()
|
cm.Unlock()
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r == nil {
|
if r := recover(); r != nil {
|
||||||
|
t.Log("panic detected:", r) // Log the panic message
|
||||||
|
} else {
|
||||||
t.Fatal("expected Unlock to panic when already unlocked")
|
t.Fatal("expected Unlock to panic when already unlocked")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
@ -60,8 +62,10 @@ func TestClosableMutex_Close(t *testing.T) {
|
||||||
cm.MustLock()
|
cm.MustLock()
|
||||||
cm.Close()
|
cm.Close()
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r == nil {
|
if r := recover(); r != nil {
|
||||||
t.Fatal("expected Close to panic when already closed")
|
t.Log("panic detected:", r) // Log the panic message
|
||||||
|
} else {
|
||||||
|
t.Fatal("expected Close to panic when already closed", r)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
cm.Close()
|
cm.Close()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue