2017-05-26 00:27:36 +08:00
|
|
|
package spflib
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestParse(t *testing.T) {
|
2017-09-30 03:30:36 +08:00
|
|
|
dnsres, err := NewCache("testdata-dns1.json")
|
2017-05-26 00:27:36 +08:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
rec, err := Parse(strings.Join([]string{"v=spf1",
|
|
|
|
"ip4:198.252.206.0/24",
|
|
|
|
"ip4:192.111.0.0/24",
|
|
|
|
"include:_spf.google.com",
|
|
|
|
"include:mailgun.org",
|
|
|
|
"include:spf-basic.fogcreek.com",
|
|
|
|
"include:mail.zendesk.com",
|
|
|
|
"include:servers.mcsv.net",
|
|
|
|
"include:sendgrid.net",
|
|
|
|
"include:spf.mtasv.net",
|
|
|
|
"~all"}, " "), dnsres)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
2017-09-30 03:30:36 +08:00
|
|
|
t.Log(rec.Print())
|
2017-05-26 00:27:36 +08:00
|
|
|
}
|