blob: a7799322e4dc3309315b221fb689e6ca8fc0d79d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package log
import (
"bytes"
"context"
golog "log"
"strings"
"testing"
"github.com/miekg/dns"
)
type p struct{}
func (p p) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
return 0, nil
}
func (p p) Name() string { return "testplugin" }
func TestPlugins(t *testing.T) {
var f bytes.Buffer
const ts = "test"
golog.SetOutput(&f)
lg := NewWithPlugin(p{})
lg.Info(ts)
if x := f.String(); !strings.Contains(x, "plugin/testplugin") {
t.Errorf("Expected log to be %s, got %s", info+ts, x)
}
}
|