@@ -18,7 +18,6 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"go.gearno.de/x/ref"
|
||||
"go.probo.inc/probo/pkg/mail"
|
||||
)
|
||||
|
||||
@@ -236,7 +235,7 @@ func TestRealWorldExample(t *testing.T) {
|
||||
Email: "",
|
||||
Password: "123",
|
||||
Age: 15,
|
||||
Website: ref.Ref("not-a-url"),
|
||||
Website: new("not-a-url"),
|
||||
Address: Address{
|
||||
City: "",
|
||||
ZipCode: "12345",
|
||||
|
||||
@@ -16,8 +16,6 @@ package validator
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"go.gearno.de/x/ref"
|
||||
)
|
||||
|
||||
func TestMin(t *testing.T) {
|
||||
@@ -30,7 +28,7 @@ func TestMin(t *testing.T) {
|
||||
{"valid int", 10, 5, false},
|
||||
{"exact min", 5, 5, false},
|
||||
{"below min", 3, 5, true},
|
||||
{"valid int pointer", ref.Ref(10), 5, false},
|
||||
{"valid int pointer", new(10), 5, false},
|
||||
{"nil pointer", (*int)(nil), 5, false}, // Skip validation
|
||||
{"non-numeric", "test", 5, true},
|
||||
}
|
||||
@@ -55,7 +53,7 @@ func TestMax(t *testing.T) {
|
||||
{"valid int", 5, 10, false},
|
||||
{"exact max", 10, 10, false},
|
||||
{"above max", 15, 10, true},
|
||||
{"valid int pointer", ref.Ref(5), 10, false},
|
||||
{"valid int pointer", new(5), 10, false},
|
||||
{"nil pointer", (*int)(nil), 10, false}, // Skip validation
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@ package validator
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"go.gearno.de/x/ref"
|
||||
)
|
||||
|
||||
func TestMinLen(t *testing.T) {
|
||||
@@ -31,7 +29,7 @@ func TestMinLen(t *testing.T) {
|
||||
{"exact length", "hello", 5, false},
|
||||
{"too short", "hi", 5, true},
|
||||
{"nil pointer", (*string)(nil), 5, false}, // Skip validation
|
||||
{"valid pointer", ref.Ref("hello"), 3, false},
|
||||
{"valid pointer", new("hello"), 3, false},
|
||||
{"non-string", 123, 5, true},
|
||||
}
|
||||
|
||||
@@ -56,7 +54,7 @@ func TestMaxLen(t *testing.T) {
|
||||
{"exact length", "hello", 5, false},
|
||||
{"too long", "hello world", 5, true},
|
||||
{"nil pointer", (*string)(nil), 5, false}, // Skip validation
|
||||
{"valid pointer", ref.Ref("hi"), 5, false},
|
||||
{"valid pointer", new("hi"), 5, false},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
Reference in New Issue
Block a user