Tests[SendToNewChannel]

This commit is contained in:
2022-12-14 14:30:34 +01:00
parent 66ecad27a7
commit f1e87170f0
3 changed files with 83 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ package util
import (
"fmt"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"reflect"
"runtime/debug"
"strings"
@@ -163,6 +164,14 @@ func TestFailIfErr(t *testing.T, e error) {
}
}
func AssertArrAny[T any](t *testing.T, key string, arr []T, fn func(T) bool) {
if !langext.ArrAny(arr, fn) {
t.Errorf("AssertArrAny(%s) failed", key)
t.Error(string(debug.Stack()))
t.FailNow()
}
}
func unpointer(v any) any {
if v == nil {
return v