mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
Add unit test case for func FromStrings in labels.go (#7321)
Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
This commit is contained in:
parent
f97d2ddb6e
commit
b41adab735
|
@ -368,6 +368,27 @@ func TestLabels_Equal(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestLabels_FromStrings(t *testing.T) {
|
||||
labels := FromStrings("aaa", "111", "bbb", "222")
|
||||
expected := Labels{
|
||||
{
|
||||
Name: "aaa",
|
||||
Value: "111",
|
||||
},
|
||||
{
|
||||
Name: "bbb",
|
||||
Value: "222",
|
||||
},
|
||||
}
|
||||
|
||||
testutil.Equals(t, expected, labels, "unexpected labelset")
|
||||
|
||||
defer func() { recover() }()
|
||||
FromStrings("aaa", "111", "bbb")
|
||||
|
||||
testutil.Assert(t, false, "did not panic as expected")
|
||||
}
|
||||
|
||||
func TestLabels_Compare(t *testing.T) {
|
||||
labels := Labels{
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue