From 08a85af4c3e1b3960c3ee1d1270f1f062fd99f94 Mon Sep 17 00:00:00 2001 From: jackspirou Date: Sat, 14 Sep 2024 23:50:03 -0500 Subject: [PATCH] fix bench and testing for Long methods --- README.md | 2 +- publicid.go | 2 +- publicid_benchmark_test.go | 2 +- publicid_test.go | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8ddab82..30be3ba 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ Validate checks if a given field name's public ID value is valid according to th ## func [ValidateLong]() ```go -func ValidateLong(fieldName, id string) error +func ValidateLong(, id string) error ``` validateLong checks if a given field name's public ID value is valid according to the constraints defined by package publicid. diff --git a/publicid.go b/publicid.go index 93fe307..2c17463 100644 --- a/publicid.go +++ b/publicid.go @@ -63,7 +63,7 @@ func Validate(id string) error { // validateLong checks if a given field name's public ID value is valid according to // the constraints defined by package publicid. -func ValidateLong(fieldName, id string) error { +func ValidateLong(id string) error { return validate(id, longLen) } diff --git a/publicid_benchmark_test.go b/publicid_benchmark_test.go index 1ca831c..c3c180d 100644 --- a/publicid_benchmark_test.go +++ b/publicid_benchmark_test.go @@ -63,7 +63,7 @@ func BenchmarkValidateLong(b *testing.B) { } b.ResetTimer() for i := 0; i < b.N; i++ { - err := publicid.ValidateLong("BenchmarkValidateLong", id) + err := publicid.ValidateLong(id) if err != nil { b.Fatal(err) } diff --git a/publicid_test.go b/publicid_test.go index 6d2e96a..2e05254 100644 --- a/publicid_test.go +++ b/publicid_test.go @@ -41,7 +41,7 @@ func TestLong(t *testing.T) { if len(id) != 12 { t.Errorf("Long() returned id with length %d, want 12", len(id)) } - if err := ValidateLong("TestLong", id); err != nil { + if err := ValidateLong(id); err != nil { t.Errorf("Long() returned invalid id: %v", err) } } @@ -54,7 +54,7 @@ func TestLongWithAttempts(t *testing.T) { if len(id) != 12 { t.Errorf("Long(Attempts(5)) returned id with length %d, want 12", len(id)) } - if err := ValidateLong("TestLongWithAttempts", id); err != nil { + if err := ValidateLong(id); err != nil { t.Errorf("Long(Attempts(5)) returned invalid id: %v", err) } } @@ -97,7 +97,7 @@ func TestValidateLong(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - err := ValidateLong("TestValidateLong", tc.id) + err := ValidateLong(tc.id) if (err != nil) != tc.wantError { t.Errorf("ValidateLong() error = %v, wantError %v", err, tc.wantError) }