mirror of https://bitbucket.org/ausocean/av.git
stream/mts/meta_test.go: added TestDeleteKeyAbsent to check that we get correct err when we try to delete data of key that doesn't exist
This commit is contained in:
parent
c16f144372
commit
7fc2b76e6b
|
@ -83,7 +83,7 @@ func (m *Meta) Delete(key string) error {
|
||||||
delete(m.data, key)
|
delete(m.data, key)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return errors.New("Trying to delete map entry that doesn't exist")
|
return errKeyAbsent
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Meta) Encode() []byte {
|
func (m *Meta) Encode() []byte {
|
||||||
|
|
|
@ -99,7 +99,14 @@ func TestDelete(t *testing.T) {
|
||||||
t.Errorf("Did not expect error: %v", err.Error())
|
t.Errorf("Did not expect error: %v", err.Error())
|
||||||
}
|
}
|
||||||
if _, err := meta.Get("loc"); err != errKeyAbsent {
|
if _, err := meta.Get("loc"); err != errKeyAbsent {
|
||||||
t.Errorf("Did not get expected err: %v", errKeyAbsent)
|
t.Errorf("Did not get expected err: %v", errKeyAbsent.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDeleteAbsentKey(t *testing.T) {
|
||||||
|
meta := NewMeta()
|
||||||
|
if err := meta.Delete("loc"); err != errKeyAbsent {
|
||||||
|
t.Errorf("Did not get expected err: %v", errKeyAbsent.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue