1234567891011121314151617181920212223242526272829303132333435 |
- package example
- import (
- "bytes"
- "testing"
- "github.com/coredns/coredns/plugin/pkg/dnstest"
- "github.com/coredns/coredns/plugin/test"
- "github.com/miekg/dns"
- "golang.org/x/net/context"
- )
- func TestExample(t *testing.T) {
-
- x := Example{Next: test.ErrorHandler()}
-
-
- b := &bytes.Buffer{}
- out = b
- ctx := context.TODO()
- r := new(dns.Msg)
- r.SetQuestion("example.org.", dns.TypeA)
-
-
- rec := dnstest.NewRecorder(&test.ResponseWriter{})
-
- x.ServeDNS(ctx, rec, r)
- if a := b.String(); a != "example\n" {
- t.Errorf("Failed to print '%s', got %s", example, a)
- }
- }
|