stream/mts/meta_test.go: adding comments to meta_test.go testing functions

This commit is contained in:
saxon 2019-01-27 18:33:15 +10:30
parent e1ac1ac5d4
commit 601351b021
1 changed files with 9 additions and 0 deletions

View File

@ -41,6 +41,7 @@ const (
tstData3 = "d,e,f" tstData3 = "d,e,f"
) )
// TestAddAndGet ensures that we can add metadata and then successfully get it.
func TestAddAndGet(t *testing.T) { func TestAddAndGet(t *testing.T) {
meta := NewMeta() meta := NewMeta()
meta.Add(tstKey1, tstData1) meta.Add(tstKey1, tstData1)
@ -61,6 +62,8 @@ func TestAddAndGet(t *testing.T) {
} }
} }
// TestUpdate checks that we can use Meta.Add to actually update metadata
// if it already exists in the Meta map.
func TestUpdate(t *testing.T) { func TestUpdate(t *testing.T) {
meta := NewMeta() meta := NewMeta()
meta.Add(tstKey1, tstData1) meta.Add(tstKey1, tstData1)
@ -74,6 +77,7 @@ func TestUpdate(t *testing.T) {
} }
} }
// TestAll ensures we can get a correct map using Meta.All() after adding some data
func TestAll(t *testing.T) { func TestAll(t *testing.T) {
meta := NewMeta() meta := NewMeta()
tstMap := map[string]string{ tstMap := map[string]string{
@ -90,6 +94,8 @@ func TestAll(t *testing.T) {
} }
} }
// TestGetAbsentKey ensures that we get the expected error when we try to get with
// key that does not yet exist in the Meta map.
func TestGetAbsentKey(t *testing.T) { func TestGetAbsentKey(t *testing.T) {
meta := NewMeta() meta := NewMeta()
@ -98,6 +104,7 @@ func TestGetAbsentKey(t *testing.T) {
} }
} }
// TestDelete ensures we can remove a data entry in the Meta map.
func TestDelete(t *testing.T) { func TestDelete(t *testing.T) {
meta := NewMeta() meta := NewMeta()
meta.Add(tstKey1, tstData1) meta.Add(tstKey1, tstData1)
@ -109,6 +116,8 @@ func TestDelete(t *testing.T) {
} }
} }
// TestDeleteAbsentKey checks that we get an expected error when we try to delete
// an entry in the Meta map that doesn't exist.
func TestDeleteAbsentKey(t *testing.T) { func TestDeleteAbsentKey(t *testing.T) {
meta := NewMeta() meta := NewMeta()
if err := meta.Delete(tstKey1); err != errKeyAbsent { if err := meta.Delete(tstKey1); err != errKeyAbsent {