aboutsummaryrefslogtreecommitdiff
path: root/assert/errequal_test.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2026-08-18 11:30:54 +0200
committerStefan Majewsky <majewsky@gmx.net>2026-08-18 11:30:54 +0200
commit50ba9cfb04e257fafa3fdd566f9f70a1986339e8 (patch)
treeb4601a46bd2c9b90297e8055bec7d60afc07cdb1 /assert/errequal_test.go
parent22e8f3548a72c78deccedc5a65c1cba029f52e6d (diff)
downloadgo-gg-50ba9cfb04e257fafa3fdd566f9f70a1986339e8.tar.gz
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.
Diffstat (limited to 'assert/errequal_test.go')
-rw-r--r--assert/errequal_test.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/assert/errequal_test.go b/assert/errequal_test.go
index b97342a..2cefeab 100644
--- a/assert/errequal_test.go
+++ b/assert/errequal_test.go
@@ -11,7 +11,6 @@ import (
"testing"
"go.xyrillian.de/gg/assert"
- "go.xyrillian.de/gg/testcapture"
)
func TestErrEqual(t *testing.T) {
@@ -67,13 +66,10 @@ func TestErrEqual(t *testing.T) {
}, `expected an error matching /foo/, but got no error`)
// test matching against unexpected type
- result := testcapture.Capture(t.Context(), t.Name(), func(t assert.TestingTB) {
+ result := assert.PanicsWith[string](t, func() {
assert.ErrEqual(t, errors.New("42"), 42)
})
- assert.Equal(t, result, testcapture.Result{
- Outcome: testcapture.OutcomePanicked,
- Panic: "cannot handle `expected` of type int",
- })
+ assert.Equal(t, result, "cannot handle `expected` of type int")
// an earlier version had a bug because this call caused reflect.Value.IsNil() to be called on a value of kind Struct
expectErrors(t, func(t assert.TestingTB) {