aboutsummaryrefslogtreecommitdiff
path: root/plugin/pkg/nonwriter/nonwriter_test.go
blob: d8433af55fb74f8c157eb2d781a1218a17bb6f18 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package nonwriter

import (
	"testing"

	"github.com/miekg/dns"
)

func TestNonWriter(t *testing.T) {
	nw := New(nil)
	m := new(dns.Msg)
	m.SetQuestion("example.org.", dns.TypeA)
	if err := nw.WriteMsg(m); err != nil {
		t.Errorf("Got error when writing to nonwriter: %s", err)
	}
	if x := nw.Msg.Question[0].Name; x != "example.org." {
		t.Errorf("Expacted 'example.org.' got %q:", x)
	}
}