Remove deadcode

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-03-13 16:50:35 +01:00
parent 7fd4221199
commit ef76a8d2e1
76 changed files with 137 additions and 4424 deletions

View File

@@ -298,8 +298,8 @@ func TestNoHTML(t *testing.T) {
title := "Product Title 2024"
v.Check(&title, "title", Required(), NoHTML(), MinLen(3), MaxLen(100))
if v.HasErrors() {
t.Errorf("expected no errors, got: %v", v.Errors())
if v.Error() != nil {
t.Errorf("expected no errors, got: %v", v.Error())
}
})
@@ -308,8 +308,8 @@ func TestNoHTML(t *testing.T) {
title := "José García-O'Brien"
v.Check(&title, "title", Required(), NoHTML(), PrintableText(), MinLen(3), MaxLen(100))
if v.HasErrors() {
t.Errorf("expected no errors, got: %v", v.Errors())
if v.Error() != nil {
t.Errorf("expected no errors, got: %v", v.Error())
}
})
@@ -318,12 +318,12 @@ func TestNoHTML(t *testing.T) {
malicious := "<script>alert('xss')</script>"
v.Check(&malicious, "content", Required(), NoHTML(), PrintableText())
if !v.HasErrors() {
if v.Error() == nil {
t.Error("expected validation errors")
}
// Should have error from NoHTML
errors := v.Errors()
errors := v.Error().(ValidationErrors)
found := false
for _, err := range errors {
if strings.Contains(err.Message, "HTML tags") {
@@ -341,12 +341,12 @@ func TestNoHTML(t *testing.T) {
malicious := "<b>test\x00text</b>"
v.Check(&malicious, "content", NoHTML(), PrintableText())
if !v.HasErrors() {
if v.Error() == nil {
t.Error("expected validation errors")
}
// Should have at least one error (NoHTML will catch it first)
if len(v.Errors()) < 1 {
if ve := v.Error(); ve == nil || len(ve.(ValidationErrors)) < 1 {
t.Error("expected at least one validation error")
}
})
@@ -635,8 +635,8 @@ func TestPrintableText(t *testing.T) {
title := "Product Title 2024"
v.Check(&title, "title", Required(), PrintableText(), MinLen(3), MaxLen(100))
if v.HasErrors() {
t.Errorf("expected no errors, got: %v", v.Errors())
if v.Error() != nil {
t.Errorf("expected no errors, got: %v", v.Error())
}
})
@@ -840,8 +840,8 @@ func TestSafeText(t *testing.T) {
title := "Product Title 2024"
v.Check(&title, "title", SafeText(100))
if v.HasErrors() {
t.Errorf("expected no errors, got: %v", v.Errors())
if v.Error() != nil {
t.Errorf("expected no errors, got: %v", v.Error())
}
})
@@ -850,11 +850,11 @@ func TestSafeText(t *testing.T) {
malicious := "<script>alert('xss')</script>"
v.Check(&malicious, "content", SafeText(100))
if !v.HasErrors() {
if v.Error() == nil {
t.Error("expected validation errors")
}
errors := v.Errors()
errors := v.Error().(ValidationErrors)
found := false
for _, err := range errors {
if strings.Contains(err.Message, "HTML tags") {