aboutsummaryrefslogtreecommitdiff
path: root/middleware/pkg/dnsutil/join_test.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2017-08-19 15:22:09 +0100
committerGravatar GitHub <noreply@github.com> 2017-08-19 15:22:09 +0100
commit02955d7594c84c5cd320ff0190ecd26425db5217 (patch)
treefed08b82ac41fe3fb77c8a3c2e781975c3e7793c /middleware/pkg/dnsutil/join_test.go
parent7c343982a6dbefc0291e0b7ecaf64d8e32124bbc (diff)
downloadcoredns-02955d7594c84c5cd320ff0190ecd26425db5217.tar.gz
coredns-02955d7594c84c5cd320ff0190ecd26425db5217.tar.zst
coredns-02955d7594c84c5cd320ff0190ecd26425db5217.zip
Dns.join (#944)
* Add dnsutil.Join * Create dnsutil.Join Create Join helper function and move bits in the code over.
Diffstat (limited to 'middleware/pkg/dnsutil/join_test.go')
-rw-r--r--middleware/pkg/dnsutil/join_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/middleware/pkg/dnsutil/join_test.go b/middleware/pkg/dnsutil/join_test.go
new file mode 100644
index 000000000..26eeb5897
--- /dev/null
+++ b/middleware/pkg/dnsutil/join_test.go
@@ -0,0 +1,20 @@
+package dnsutil
+
+import "testing"
+
+func TestJoin(t *testing.T) {
+ tests := []struct {
+ in []string
+ out string
+ }{
+ {[]string{"bla", "bliep", "example", "org"}, "bla.bliep.example.org."},
+ {[]string{"example", "."}, "example."},
+ {[]string{"."}, "."},
+ }
+
+ for i, tc := range tests {
+ if x := Join(tc.in); x != tc.out {
+ t.Errorf("Test %d, expected %s, got %s", i, tc.out, x)
+ }
+ }
+}