MCPcopy Index your code
hub / github.com/foxcpp/maddy / TestValidDomain

Function TestValidDomain

framework/address/validation_test.go:16–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14}
15
16func TestValidDomain(t *testing.T) {
17 for _, c := range []struct {
18 Domain string
19 Valid bool
20 }{
21 {Domain: "maddy.email", Valid: true},
22 {Domain: "", Valid: false},
23 {Domain: "maddy.email.", Valid: true},
24 {Domain: "..", Valid: false},
25 {Domain: strings.Repeat("a", 256), Valid: false},
26 {Domain: "äõäoaõoäaõaäõaoäaoaäõoaäooaoaoiuaiauäõiuüõaõäiauõaaa.tld", Valid: true}, // https://github.com/foxcpp/maddy/issues/554
27 {Domain: "xn--oaoaaaoaoaoaooaoaoiuaiauiuaiauaaa-f1cadccdcmd01eddchqcbe07a.tld", Valid: true}, // https://github.com/foxcpp/maddy/issues/554
28 } {
29 if actual := address.ValidDomain(c.Domain); actual != c.Valid {
30 t.Errorf("expected domain %v to be valid=%v, but got %v", c.Domain, c.Valid, actual)
31 }
32 }
33}

Callers

nothing calls this directly

Calls 1

ValidDomainFunction · 0.92

Tested by

no test coverage detected