Also test reserialisation

This commit is contained in:
Kegan Dougal 2020-07-29 14:18:13 +01:00
parent 2bde8b59a4
commit e9ef552ca0
2 changed files with 4 additions and 1 deletions

View file

@ -129,7 +129,7 @@ func (t *StreamingToken) String() string {
t.syncToken.String(), t.syncToken.String(),
} }
for name, lp := range t.logs { for name, lp := range t.logs {
logStr := fmt.Sprintf("%s%d-%d", name, lp.Partition, lp.Offset) logStr := fmt.Sprintf("%s-%d-%d", name, lp.Partition, lp.Offset)
logStrings = append(logStrings, logStr) logStrings = append(logStrings, logStr)
} }
// E.g s11_22_33|dl0-134|ab1-441 // E.g s11_22_33|dl0-134|ab1-441

View file

@ -46,6 +46,9 @@ func TestNewSyncTokenWithLogs(t *testing.T) {
if !reflect.DeepEqual(got, *want) { if !reflect.DeepEqual(got, *want) {
t.Errorf("%s mismatch: got %v want %v", tok, got, want) t.Errorf("%s mismatch: got %v want %v", tok, got, want)
} }
if got.String() != tok {
t.Errorf("%s reserialisation mismatch: got %s want %s", tok, got.String(), tok)
}
} }
} }