mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-11-10 17:26:10 +08:00
8dea9edc34
TXT records are now handled different. 1. The raw input from dnsconfig.js is passed all the way to the provider. The provider can determine if it can or can't handle such records (auditrecords.go) and processes them internally as such. 2. The CanUseTXTMulti capability is no longer needed. * DSPs now register a table of functions * Use audits for txt record variations * unit tests pass. integration fails. * fix deepcopy problem * rename to AuditRecordSupport * Reduce use of TXTMulti * Remove CanUseTXTMulti * fix Test Skip * fix DO * fix vultr * fix NDC * msdns fixes * Fix powerdns and cloudflare * HEDNS: Fix usage of target field to resolve TXT handling (#1067) * Fix HEXONET Co-authored-by: Robert Blenkinsopp <robert@blenkinsopp.net> Co-authored-by: Jakob Ackermann <das7pad@outlook.com>
35 lines
853 B
Go
35 lines
853 B
Go
package txtutil
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func Test_splitChunks(t *testing.T) {
|
|
type args struct {
|
|
buf string
|
|
lim int
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want []string
|
|
}{
|
|
{"0", args{"", 3}, []string{}},
|
|
{"1", args{"a", 3}, []string{"a"}},
|
|
{"2", args{"ab", 3}, []string{"ab"}},
|
|
{"3", args{"abc", 3}, []string{"abc"}},
|
|
{"4", args{"abcd", 3}, []string{"abc", "d"}},
|
|
{"5", args{"abcde", 3}, []string{"abc", "de"}},
|
|
{"6", args{"abcdef", 3}, []string{"abc", "def"}},
|
|
{"7", args{"abcdefg", 3}, []string{"abc", "def", "g"}},
|
|
{"8", args{"abcdefgh", 3}, []string{"abc", "def", "gh"}},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := splitChunks(tt.args.buf, tt.args.lim); !reflect.DeepEqual(got, tt.want) {
|
|
t.Errorf("splitChunks() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|