From 807a25b638e38d7c0446bb728412fb16fd035035 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Sat, 4 Jan 2025 15:08:53 +0100 Subject: init --- internal/test/helpers.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 internal/test/helpers.go (limited to 'internal/test/helpers.go') diff --git a/internal/test/helpers.go b/internal/test/helpers.go new file mode 100644 index 0000000..a93aa9e --- /dev/null +++ b/internal/test/helpers.go @@ -0,0 +1,24 @@ +/******************************************************************************* +* Copyright 2025 Stefan Majewsky +* SPDX-License-Identifier: Apache-2.0 +* Refer to the file "LICENSE" for details. +*******************************************************************************/ + +package option + +import ( + "reflect" + "testing" +) + +func AssertEqual[V any](t *testing.T, actual, expected V) { + if reflect.DeepEqual(actual, expected) { + return + } + t.Helper() + t.Errorf("expected %#v, but got %#v", expected, actual) +} + +func PointerTo[V any](value V) *V { + return &value +} -- cgit v1.2.3