mirror of https://bitbucket.org/ausocean/av.git
stream/mts/encoder.go: not doing scoped conditional in writePSI when calling updateMeta
This commit is contained in:
parent
6425403fcb
commit
dc46d9f0b2
|
@ -216,8 +216,8 @@ func (e *Encoder) writePSI() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
err = updateMeta(&pmtTable)
|
||||||
if err = updateMeta(&pmtTable); err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,9 @@ package meta
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
"encoding/binary"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -53,7 +53,6 @@ func TestAddAndGet(t *testing.T) {
|
||||||
meta := New()
|
meta := New()
|
||||||
meta.Add(tstKey1, tstData1)
|
meta.Add(tstKey1, tstData1)
|
||||||
meta.Add(tstKey2, tstData2)
|
meta.Add(tstKey2, tstData2)
|
||||||
errors.New("Trying to delete map entry that doesn't exist")
|
|
||||||
if data, err := meta.Get(tstKey1); err != nil {
|
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.Error())
|
||||||
if data != tstData1 {
|
if data != tstData1 {
|
||||||
|
@ -139,13 +138,12 @@ func TestEncode(t *testing.T) {
|
||||||
meta.Add(tstKey2, tstData2)
|
meta.Add(tstKey2, tstData2)
|
||||||
|
|
||||||
dataLen := len(tstKey1+tstData1+tstKey2+tstData2) + 3
|
dataLen := len(tstKey1+tstData1+tstKey2+tstData2) + 3
|
||||||
expectedOut := []byte{
|
header := [4]byte{
|
||||||
0x00,
|
0x00,
|
||||||
0x10,
|
0x10,
|
||||||
byte(dataLen >> 8),
|
|
||||||
byte(dataLen),
|
|
||||||
}
|
}
|
||||||
expectedOut = append(expectedOut, []byte(
|
binary.BigEndian.PutUint16(header[2:4],uint16(dataLen))
|
||||||
|
expectedOut := append(header[:], []byte(
|
||||||
tstKey1+"="+tstData1+"\t"+
|
tstKey1+"="+tstData1+"\t"+
|
||||||
tstKey2+"="+tstData2)...)
|
tstKey2+"="+tstData2)...)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue