container/mts/meta: wrote test for GetAllAsMap

This commit is contained in:
Saxon 2019-06-11 22:15:27 +09:30
parent 9af964cfc9
commit 482f5609e5
1 changed files with 17 additions and 0 deletions

View File

@ -189,6 +189,23 @@ func TestGetAll(t *testing.T) {
}
}
// TestGetAllAsMap checks that GetAllAsMap will correctly return a map of meta
// keys and values from a slice of meta.
func TestGetAllAsMap(t *testing.T) {
tstMeta := append([]byte{0x00, 0x10, 0x00, 0x12}, "loc=a,b,c\tts=12345"...)
want := map[string]string{
"loc": "a,b,c",
"ts": "12345",
}
got, err := GetAllAsMap(tstMeta)
if err != nil {
t.Errorf("Unexpected error: %v\n", err)
}
if !reflect.DeepEqual(got, want) {
t.Errorf("Did not get expected out. \nGot : %v, \nWant: %v\n", got, want)
}
}
// TestKeys checks that we can successfully get keys from some metadata using
// the meta.Keys method.
func TestKeys(t *testing.T) {