From 63df99f2e1c742069464d219a9f340c1f8f5bd90 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Thu, 17 Sep 2026 16:21:40 +0200 Subject: oblast: import from go.xyrillian.de/oblast - type RuntimeIndex is left behind for now because I don't want to commit to the method names yet - the "OrNone" methods are removed in favor of gsql.NoneIfNoRows() --- benchmark/internal/testhelpers/must/must.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 benchmark/internal/testhelpers/must/must.go (limited to 'benchmark/internal/testhelpers') diff --git a/benchmark/internal/testhelpers/must/must.go b/benchmark/internal/testhelpers/must/must.go new file mode 100644 index 0000000..7a137c6 --- /dev/null +++ b/benchmark/internal/testhelpers/must/must.go @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2026 Stefan Majewsky +// SPDX-License-Identifier: Apache-2.0 + +package must + +import "testing" + +// Succeed fails the test if err is not nil. +func Succeed(t testing.TB, err error) { + t.Helper() + if err != nil { + t.Fatal(err.Error()) + } +} + +// Return wraps a function returning two output values, +// and either forwards the result value on success, or fails the test on error. +func Return[V any](value V, err error) func(testing.TB) V { + return func(t testing.TB) V { + t.Helper() + if err != nil { + t.Fatal(err.Error()) + } + return value + } +} -- cgit v1.3.1