...
1 package lv
2
3 import (
4 "strings"
5 "testing"
6 )
7
8 func TestWith(t *testing.T) {
9 var a LabelValues
10 b := a.With("a", "1")
11 c := a.With("b", "2", "c", "3")
12
13 if want, have := "", strings.Join(a, ""); want != have {
14 t.Errorf("With appears to mutate the original LabelValues: want %q, have %q", want, have)
15 }
16 if want, have := "a1", strings.Join(b, ""); want != have {
17 t.Errorf("With does not appear to return the right thing: want %q, have %q", want, have)
18 }
19 if want, have := "b2c3", strings.Join(c, ""); want != have {
20 t.Errorf("With does not appear to return the right thing: want %q, have %q", want, have)
21 }
22 }
23
View as plain text