From 50ba9cfb04e257fafa3fdd566f9f70a1986339e8 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Tue, 18 Aug 2026 11:30:54 +0200 Subject: assert: add Panics, PanicsWith I want to use this for test coverage in microprom. This turned out to be a bigger change than expected because testcapture has a dependency on assert, which I had to invert to be able to use testcapture.Capture() in assert. --- pathrouter/pathrouter_test.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'pathrouter') diff --git a/pathrouter/pathrouter_test.go b/pathrouter/pathrouter_test.go index 3e91ce9..54108ac 100644 --- a/pathrouter/pathrouter_test.go +++ b/pathrouter/pathrouter_test.go @@ -14,7 +14,6 @@ import ( "go.xyrillian.de/gg/assert" pr "go.xyrillian.de/gg/pathrouter" - "go.xyrillian.de/gg/testcapture" ) func TestRouting(t *testing.T) { @@ -157,11 +156,8 @@ func TestRouting(t *testing.T) { func TestPanics(t *testing.T) { check := func(expected string, action func()) { t.Helper() - result := testcapture.Capture(t.Context(), t.Name(), func(t assert.TestingTB) { action() }) - assert.Equal(t, result, testcapture.Result{ - Outcome: testcapture.OutcomePanicked, - Panic: expected, - }) + actual := assert.PanicsWith[string](t, action) + assert.Equal(t, actual, expected) } check(`matcher within CatchAllVariable() may not accept unlimited path lengths`, func() { -- cgit v1.3.1