From 71d31d73e7dc3b9cdb3c53b4f343b1928a9e858b Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Thu, 18 Jun 2026 23:23:36 +0200 Subject: add package testcapture, package assert (minimal implementation) --- assert/equal.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 assert/equal.go (limited to 'assert/equal.go') diff --git a/assert/equal.go b/assert/equal.go new file mode 100644 index 0000000..1222ecf --- /dev/null +++ b/assert/equal.go @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: 2026 Stefan Majewsky +// SPDX-License-Identifier: Apache-2.0 + +package assert + +import "reflect" + +// Equal checks whether both supplied values are equal according to the rules of [reflect.DeepEqual]. +func Equal[V any](t TestingTB, actual, expected V) bool { + if reflect.DeepEqual(actual, expected) { + return true + } + t.Helper() + t.Errorf("expected %#v, but got %#v", expected, actual) + return false +} -- cgit v1.3.1