tiltwind commented on code in PR #366: URL: https://github.com/apache/dubbo-go-hessian2/pull/366#discussion_r1378415059
########## map_test.go: ########## @@ -182,3 +182,42 @@ func TestJavaMap(t *testing.T) { RegisterPOJO(customMap) testJavaDecode(t, "customArgTypedFixed_CustomMap", customMap) } + +type Obj struct { + Map8 map[int8]int8 + Map16 map[int16]int16 + Map32 map[int32]int32 +} + +func (Obj) JavaClassName() string { + return "" +} + +func TestMapInObject(t *testing.T) { + var ( + obj Obj + e *Encoder + d *Decoder + err error + res interface{} + ) + + obj = Obj{ + Map8: map[int8]int8{1: 2, 3: 4}, + Map16: map[int16]int16{1: 2, 3: 4}, + Map32: map[int32]int32{1: 2, 3: 4}, + } + + e = NewEncoder() + e.Encode(obj) + if len(e.Buffer()) == 0 { + t.Fail() + } + + d = NewDecoder(e.Buffer()) + res, err = d.Decode() + if err != nil { + t.Errorf("Decode() = %+v", err) + } + t.Logf("decode(%v) = %v, %v\n", obj, res, err) Review Comment: should check whether the decode value is equal to the original -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org