updated tests for new behavior

This commit is contained in:
yusing
2024-10-11 10:00:10 +08:00
6 changed files with 142 additions and 91 deletions

View File

@@ -7,6 +7,7 @@ import (
"testing"
"github.com/yusing/go-proxy/internal/common"
E "github.com/yusing/go-proxy/internal/error"
)
func init() {
@@ -96,3 +97,17 @@ func ExpectType[T any](t *testing.T, got any) (_ T) {
}
return got.(T)
}
func Must[T any](v T, err E.NestedError) T {
if err != nil {
panic(err)
}
return v
}
func Must2[T any](v T, err error) T {
if err != nil {
panic(err)
}
return v
}