@@ -6,23 +6,27 @@ import (
66)
77
88func TestStreamIDMarshalUnmarshalString (t * testing.T ) {
9- f := func (sid * streamID ) {
9+ f := func (sid * streamID , resultExpected string ) {
1010 t .Helper ()
1111
12- s := string (sid .marshalString (nil ))
12+ result := string (sid .marshalString (nil ))
13+
14+ if result != resultExpected {
15+ t .Fatalf ("unexpected result\n got\n %q\n want\n %q" , result , resultExpected )
16+ }
1317
1418 var sid2 streamID
15- if ! sid2 .tryUnmarshalFromString (s ) {
16- t .Fatalf ("cannot unmarshal streamID from %q" , s )
19+ if ! sid2 .tryUnmarshalFromString (result ) {
20+ t .Fatalf ("cannot unmarshal streamID from %q" , result )
1721 }
1822
19- s2 := string (sid2 .marshalString (nil ))
20- if s != s2 {
21- t .Fatalf ("unexpected marshaled streamID; got %s; want %s" , s2 , s )
23+ result2 := string (sid2 .marshalString (nil ))
24+ if result != result2 {
25+ t .Fatalf ("unexpected marshaled streamID; got %s; want %s" , result2 , result )
2226 }
2327 }
2428
25- f (& streamID {})
29+ f (& streamID {}, "000000000000000000000000000000000000000000000000" )
2630 f (& streamID {
2731 tenantID : TenantID {
2832 AccountID : 123 ,
@@ -32,7 +36,7 @@ func TestStreamIDMarshalUnmarshalString(t *testing.T) {
3236 lo : 89 ,
3337 hi : 344334 ,
3438 },
35- })
39+ }, "0000007b000001c8000000000005410e0000000000000059" )
3640}
3741
3842func TestStreamIDMarshalUnmarshal (t * testing.T ) {
0 commit comments