From 17d06f49f4063a9deea8262eaccc323f5519a0a1 Mon Sep 17 00:00:00 2001 From: saxon Date: Sun, 27 Jan 2019 18:02:51 +1030 Subject: [PATCH] stream/mts/meta_test.go: added TestAll func to make sure Meta.All is working correctly --- stream/mts/meta_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/stream/mts/meta_test.go b/stream/mts/meta_test.go index 3b0662c9..e5ae04e6 100644 --- a/stream/mts/meta_test.go +++ b/stream/mts/meta_test.go @@ -28,6 +28,7 @@ LICENSE package mts import ( + "reflect" "testing" ) @@ -66,6 +67,22 @@ func TestUpdate(t *testing.T) { } } +func TestAll(t *testing.T) { + meta := NewMeta() + tstMap := map[string]string{ + "loc": "a,b,c", + "ts": "12345678", + } + + meta.Add("loc", "a,b,c") + meta.Add("ts", "12345678") + metaMap := meta.All() + + if !reflect.DeepEqual(metaMap, tstMap) { + t.Errorf("Map not correct. Got: %v, want: %v", metaMap, tstMap) + } +} + // TODO: test all // TODO: test get when key exists // TODO: test get when key doesn't exist