aboutsummaryrefslogtreecommitdiff
path: root/assert/equal.go
diff options
context:
space:
mode:
Diffstat (limited to 'assert/equal.go')
-rw-r--r--assert/equal.go16
1 files changed, 16 insertions, 0 deletions
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 <majewsky@gmx.net>
+// 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
+}