1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-07-16 18:54:22 +02:00

merge v0.23.0-rc changes

This commit is contained in:
Gani Georgiev
2024-09-29 19:23:19 +03:00
parent ad92992324
commit 844f18cac3
753 changed files with 85141 additions and 63396 deletions

View File

@ -0,0 +1,33 @@
package validators_test
import (
"fmt"
"testing"
"github.com/pocketbase/pocketbase/core/validators"
)
func TestIsRegex(t *testing.T) {
t.Parallel()
scenarios := []struct {
val string
expectError bool
}{
{"", false},
{`abc`, false},
{`\w+`, false},
{`\w*((abc+`, true},
}
for i, s := range scenarios {
t.Run(fmt.Sprintf("%d_%#v", i, s.val), func(t *testing.T) {
err := validators.IsRegex(s.val)
hasErr := err != nil
if hasErr != s.expectError {
t.Fatalf("Expected hasErr to be %v, got %v (%v)", s.expectError, hasErr, err)
}
})
}
}