Package list golang-github-dcso-fluxline / fresh-snapshots/main
New upstream snapshot. Debian Janitor 2 years ago
3 changed file(s) with 38 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 golang-github-dcso-fluxline (0.0~git20190516.1c6f5a3-1) UNRELEASED; urgency=medium
1
2 * New upstream snapshot.
3
4 -- Debian Janitor <janitor@jelmer.uk> Sun, 23 Jun 2019 03:13:25 +0000
5
06 golang-github-dcso-fluxline (0.0~git20181026.4f8ed83-1) unstable; urgency=medium
17
28 * New upstream snapshot.
159159 }
160160 return a
161161 }
162
163 // NewEncoderWithHostname creates a new encoder that writes to the given
164 // io.Writer with an overridden hostname
165 func NewEncoderWithHostname(w io.Writer, host string) *Encoder {
166 a := &Encoder{
167 host: host,
168 Writer: w,
169 }
170 return a
171 }
9090 }
9191 }
9292
93 func TestEncoderEncoderWithHostname(t *testing.T) {
94 var b bytes.Buffer
95
96 ile := NewEncoderWithHostname(&b, "testhost")
97 tags := make(map[string]string)
98 tags["foo"] = "bar"
99 tags["baaz gogo"] = "gu,gu"
100 err := ile.Encode("mytool", testStruct, tags)
101 if err != nil {
102 t.Fatal(err)
103 }
104
105 out := b.String()
106 if len(out) == 0 {
107 t.Fatalf("unexpected result length: %d == 0", len(out))
108 }
109
110 if match, _ := regexp.Match(`^mytool,host=testhost,baaz\\ gogo=gu\\,gu,foo=bar testval=1i,testvalue=2i,testvalue2=-3i,testvalue3=\"foobar\\\"baz\",testvaluebool=false,testvalueflt32=3.1415927,testvalueflt64=1.29e-24,testvaluetime=`, []byte(out)); !match {
111 t.Fatalf("unexpected match content: %s", out)
112 }
113 }
114
93115 func TestEncoderTypeFail(t *testing.T) {
94116 var b bytes.Buffer
95117