mirror of https://bitbucket.org/ausocean/av.git
stream/mts/meta/meta_test.go: fixed up error logging in meta_test.go i.e. not doing err.Error() for %v format specifiers, and not using t.Errorf when we have no arguments
This commit is contained in:
parent
ad671b520c
commit
f96f761b2f
|
@ -48,16 +48,16 @@ func TestAddAndGet(t *testing.T) {
|
|||
meta.Add(tstKey1, tstData1)
|
||||
meta.Add(tstKey2, tstData2)
|
||||
if data, err := meta.Get(tstKey1); err != nil {
|
||||
t.Errorf("Could not get data for key: loc: %v", err.Error())
|
||||
t.Errorf("Could not get data for key: loc: %v", err)
|
||||
if data != tstData1 {
|
||||
t.Errorf("Did not get expected data")
|
||||
t.Error("Did not get expected data")
|
||||
}
|
||||
}
|
||||
|
||||
if data, err := meta.Get(tstKey2); err != nil {
|
||||
t.Errorf("Could not get data for key: ts: %v", err.Error())
|
||||
t.Errorf("Could not get data for key: ts: %v", err)
|
||||
if data != tstData2 {
|
||||
t.Errorf("Did not get expected data")
|
||||
t.Error("Did not get expected data")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,9 +70,9 @@ func TestUpdate(t *testing.T) {
|
|||
meta.Add(tstKey1, tstData3)
|
||||
|
||||
if data, err := meta.Get(tstKey1); err != nil {
|
||||
t.Errorf("Unexpected err: %v\n", err.Error())
|
||||
t.Errorf("Unexpected err: %v\n", err)
|
||||
if data != tstData2 {
|
||||
t.Errorf("Data did not correctly update for key \"loc\"")
|
||||
t.Error(`Data did not correctly update for key "loc"`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ func TestGetAbsentKey(t *testing.T) {
|
|||
meta := New()
|
||||
|
||||
if _, err := meta.Get(tstKey1); err != errKeyAbsent {
|
||||
t.Errorf("Not expected err: %v\n", errKeyAbsent.Error())
|
||||
t.Errorf("Not expected err: %v\n", errKeyAbsent)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,10 +109,10 @@ func TestDelete(t *testing.T) {
|
|||
meta := New()
|
||||
meta.Add(tstKey1, tstData1)
|
||||
if err := meta.Delete(tstKey1); err != nil {
|
||||
t.Errorf("Unexpected err: %v\n", err.Error())
|
||||
t.Errorf("Unexpected err: %v\n", err)
|
||||
}
|
||||
if _, err := meta.Get(tstKey1); err != errKeyAbsent {
|
||||
t.Errorf("Not expected err: %v\n", errKeyAbsent.Error())
|
||||
t.Errorf("Not expected err. got: %v\n, want: $%v\n", err, errKeyAbsent)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ func TestDelete(t *testing.T) {
|
|||
func TestDeleteAbsentKey(t *testing.T) {
|
||||
meta := New()
|
||||
if err := meta.Delete(tstKey1); err != errKeyAbsent {
|
||||
t.Errorf("Not expected err: %v\n", errKeyAbsent.Error())
|
||||
t.Errorf("Not expected err: %v\n", errKeyAbsent)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ func TestReadFrom(t *testing.T) {
|
|||
tstMeta := append([]byte{0x00, 0x10, 0x00, 0x12}, "loc=a,b,c\tts=12345"...)
|
||||
got, err := ReadFrom([]byte(tstMeta), "loc")
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected err: %v\n", err.Error())
|
||||
t.Errorf("Unexpected err: %v\n", err)
|
||||
}
|
||||
want := "a,b,c"
|
||||
if got != want {
|
||||
|
@ -161,7 +161,7 @@ func TestReadFrom(t *testing.T) {
|
|||
}
|
||||
|
||||
if got, err = ReadFrom([]byte(tstMeta), "ts"); err != nil {
|
||||
t.Errorf("Unexpected err: %v\n", err.Error())
|
||||
t.Errorf("Unexpected err: %v\n", err)
|
||||
}
|
||||
want = "12345"
|
||||
if got != want {
|
||||
|
|
Loading…
Reference in New Issue