You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/10/23 01:46:50 UTC

[GitHub] [dubbo-go-hessian2] AlexStocks commented on a diff in pull request #327: fix enum list decoding error

AlexStocks commented on code in PR #327:
URL: https://github.com/apache/dubbo-go-hessian2/pull/327#discussion_r1002613851


##########
object_test.go:
##########
@@ -1061,3 +1062,58 @@ func TestDecodeSliceIntegerHasNull(t *testing.T) {
 	RegisterPOJO(&User{})
 	testDecodeFramework(t, "customReplyTypedListIntegerHasNull", &User{Id: 0, List: []int32{1, 0}})
 }
+
+func TestDecodeCustomReplyEnumVariableList(t *testing.T) {
+	for v := range _LocaleCategoryEnumValues {
+		RegisterJavaEnum(v)
+	}
+
+	got, err := decodeJavaResponse(`customReplyEnumVariableList`, ``, false)
+	assert.NoError(t, err)
+	t.Logf("customReplyEnumVariableList %T %+v", got, got)
+	enumList, ok := got.([]*LocaleCategoryEnum)
+	if !ok {
+		t.Errorf("expect []LocaleCategoryEnum, but get %v", got)
+		return
+	}
+	assert.Equal(t, LocaleCategoryEnumDisplay, *enumList[0])
+	assert.Nil(t, enumList[1])
+	assert.Equal(t, LocaleCategoryEnumFormat, *enumList[2])
+}
+
+const (
+	LocaleCategoryEnumDisplay LocaleCategoryEnum = iota
+	LocaleCategoryEnumFormat
+)
+
+var _LocaleCategoryEnumValues = map[LocaleCategoryEnum]string{

Review Comment:
   放在一个 var () 大 block 内



-- 
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-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org