Something went wrong. Try again.
An ATProto Powered Reputation Network
Something went wrong. Try again.
524 B · 19 lines
Go
at master
1234567891011121314151617181920package domain
import ( "strings" "testing")
func TestCommentLimits(t *testing.T) { for _, text := range []string{"", "Reference text.\n<script>", strings.Repeat("界", MaxCommentLength)} { if err := ValidateComment(text); err != nil { t.Fatalf("valid comment: %v", err) } } for _, text := range []string{strings.Repeat("a", MaxCommentLength+1), strings.Repeat("界", MaxCommentLength+1), string([]byte{0xff})} { if err := ValidateComment(text); err == nil { t.Fatal("invalid comment accepted") } }}