aboutsummaryrefslogtreecommitdiff
path: root/assert/equal.go
blob: 1222ecf2800cc98646b59d41c8bf6a16809f07cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
}