From 4486295cf20dfc6ce27b000517b7de3ff1711900 Mon Sep 17 00:00:00 2001 From: "M. J. Fromberger" Date: Mon, 6 Jan 2025 10:16:05 -0800 Subject: [PATCH] mtest: collapse redundant code --- mtest/mtest.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mtest/mtest.go b/mtest/mtest.go index b63d3b4..e4381f7 100644 --- a/mtest/mtest.go +++ b/mtest/mtest.go @@ -11,12 +11,9 @@ type TB interface { // MustPanic executes a function f that is expected to panic. // If it does so, MustPanic returns the value recovered from the // panic. Otherwise, it logs a fatal error in t. -func MustPanic(t TB, f func()) (val any) { +func MustPanic(t TB, f func()) any { t.Helper() - defer func() { val = recover() }() - f() - t.Fatalf("expected panic was not observed") - return + return MustPanicf(t, f, "expected panic was not observed") } // MustPanicf executes a function f that is expected to panic. If it does so,