chaokunyang commented on code in PR #2607:
URL: https://github.com/apache/fory/pull/2607#discussion_r2348012290


##########
go/fory/fory_metashare_test.go:
##########
@@ -0,0 +1,181 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package fory
+
+import (
+       "testing"
+
+       "github.com/stretchr/testify/assert"
+)
+
+// Test structs for metashare testing
+
+type SimpleDataClass struct {
+       Name   string `fory:"name"`
+       Age    int32  `fory:"age"`
+       Active bool   `fory:"active"`
+}
+type ExtendedDataClass struct {
+       Name   string `fory:"name"`
+       Age    int32  `fory:"age"`
+       Active bool   `fory:"active"`
+       Email  string `fory:"email"` // Additional field
+}
+
+type ReducedDataClass struct {
+       Name string `fory:"name"`
+       Age  int32  `fory:"age"`
+       // Missing 'active' field
+}
+
+func TestMetaShareEnabled(t *testing.T) {
+       fory := NewForyWithOptions(WithCompatible(true))
+
+       assert.True(t, fory.compatible, "Expected compatible mode to be 
enabled")
+       assert.NotNil(t, fory.metaContext, "Expected metaContext to be 
initialized when compatible=true")
+       assert.True(t, fory.metaContext.IsScopedMetaShareEnabled(), "Expected 
scoped meta share to be enabled by default when compatible=true")
+}
+
+func TestMetaShareDisabled(t *testing.T) {
+       fory := NewForyWithOptions(WithCompatible(false))
+
+       assert.False(t, fory.compatible, "Expected compatible mode to be 
disabled")
+       assert.Nil(t, fory.metaContext, "Expected metaContext to be nil when 
compatible=false")
+}
+
+func TestSimpleDataClassSerialization(t *testing.T) {
+       fory := NewForyWithOptions(WithCompatible(true))
+
+       // Register the struct
+       err := fory.RegisterTagType("SimpleDataClass", SimpleDataClass{})

Review Comment:
   @junjiexh Let's create an issue for this and update the API call in future 
after the API has been updated



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to