• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

laiambryant / goTestUtils / 17065000595

19 Aug 2025 09:10AM UTC coverage: 66.823% (-1.6%) from 68.408%
17065000595

push

github

laiambryant
Refactored some stuff

426 of 488 new or added lines in 15 files covered. (87.3%)

570 of 853 relevant lines covered (66.82%)

650.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.1
/pbtesting/properties/predicates/string_predicates.go
1
package predicates
2

3
import "regexp"
4

5
type StringLenMin struct{ Min int }
6
type StringLenMax struct{ Max int }
7
type StringLenRange struct{ Min, Max int }
8
type StringRegex struct{ Pattern string }
9
type StringPrefix struct{ Prefix string }
10
type StringSuffix struct{ Suffix string }
11
type StringContains struct{ Substr string }
12

13
func (p StringLenMin) Verify(v any) bool { s, ok := v.(string); return !ok || len(s) >= p.Min }
4✔
14
func (p StringLenMax) Verify(v any) bool { s, ok := v.(string); return !ok || len(s) <= p.Max }
2✔
15
func (p StringLenRange) Verify(v any) bool {
2✔
16
        s, ok := v.(string)
2✔
17
        return !ok || (len(s) >= p.Min && len(s) <= p.Max)
2✔
18
}
2✔
19
func (p StringRegex) Verify(v any) bool {
3✔
20
        s, ok := v.(string)
3✔
21
        if !ok {
4✔
22
                return false
1✔
23
        }
1✔
24
        if p.Pattern == "" {
2✔
NEW
25
                return true
×
NEW
26
        }
×
27
        re, err := regexp.Compile(p.Pattern)
2✔
28
        if err != nil {
2✔
NEW
29
                return true
×
NEW
30
        }
×
31
        return re.MatchString(s)
2✔
32
}
33
func (p StringPrefix) Verify(v any) bool {
2✔
34
        s, ok := v.(string)
2✔
35
        return !ok || (len(p.Prefix) == 0 || (len(s) >= len(p.Prefix) && s[:len(p.Prefix)] == p.Prefix))
2✔
36
}
2✔
37
func (p StringSuffix) Verify(v any) bool {
2✔
38
        s, ok := v.(string)
2✔
39
        return !ok || (len(p.Suffix) == 0 || (len(s) >= len(p.Suffix) && s[len(s)-len(p.Suffix):] == p.Suffix))
2✔
40
}
2✔
41
func (p StringContains) Verify(v any) bool {
2✔
42
        s, ok := v.(string)
2✔
43
        return !ok || (p.Substr == "" || (len(s) >= len(p.Substr) && (regexp.MustCompile(regexp.QuoteMeta(p.Substr)).FindStringIndex(s) != nil)))
2✔
44
}
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc