stream/mts/meta_test.go: added TestAll func to make sure Meta.All is working correctly

This commit is contained in:
saxon 2019-01-27 18:02:51 +10:30
parent 3bb1ca9379
commit 17d06f49f4
1 changed files with 17 additions and 0 deletions

View File

@ -28,6 +28,7 @@ LICENSE
package mts package mts
import ( import (
"reflect"
"testing" "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 all
// TODO: test get when key exists // TODO: test get when key exists
// TODO: test get when key doesn't exist // TODO: test get when key doesn't exist