mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 08:48:32 +02:00
migrated from logrus to zerolog, improved error formatting, fixed concurrent map write, fixed crash on rapid page refresh for idle containers, fixed infinite recursion on gotfiy error, fixed websocket connection problem when using idlewatcher
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/yusing/go-proxy/internal/common"
|
||||
E "github.com/yusing/go-proxy/internal/error"
|
||||
"github.com/yusing/go-proxy/internal/utils/strutils/ansi"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -52,6 +52,15 @@ func ExpectEqual[T comparable](t *testing.T, got T, want T) {
|
||||
}
|
||||
}
|
||||
|
||||
func ExpectStrEqual(t *testing.T, got string, want string) {
|
||||
t.Helper()
|
||||
got = ansi.StripANSI(got)
|
||||
if got != want {
|
||||
t.Errorf("expected:\n%v, got\n%v", want, got)
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
func ExpectEqualAny[T comparable](t *testing.T, got T, wants []T) {
|
||||
t.Helper()
|
||||
for _, want := range wants {
|
||||
@@ -97,17 +106,3 @@ func ExpectType[T any](t *testing.T, got any) (_ T) {
|
||||
}
|
||||
return got.(T)
|
||||
}
|
||||
|
||||
func Must[T any](v T, err E.Error) T {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func Must2[T any](v T, err error) T {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user