MCPcopy Create free account
hub / github.com/apache/fory / TestSerializeMap

Function TestSerializeMap

go/fory/fory_test.go:186–212  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

184}
185
186func TestSerializeMap(t *testing.T) {
187 for _, referenceTracking := range []bool{false, true} {
188 fory := NewFory(WithXlang(true), WithCompatible(false), WithRefTracking(referenceTracking))
189 // "str1" is deserialized by interface type, which will be set to map key whose type is string.
190 // so we need to save interface dynamic value type instead of interface value in reference resolver.
191 {
192 value := []any{"str1", map[string]any{"str1": "str2"}}
193 serde(t, fory, value)
194 }
195 {
196 value := map[string]any{"k1": "v1", "str": "", "": ""}
197 serde(t, fory, value)
198 }
199 {
200 value := map[string]int32{
201 "k1": MinInt32,
202 "k2": 0,
203 "k3": MaxInt32,
204 }
205 serde(t, fory, value)
206 }
207 for _, data := range commonMap() {
208 serde(t, fory, data)
209 }
210 serde(t, fory, commonMap())
211 }
212}
213
214func TestSerializeSet(t *testing.T) {
215 for _, referenceTracking := range []bool{false, true} {

Callers

nothing calls this directly

Calls 6

NewForyFunction · 0.85
WithXlangFunction · 0.85
WithCompatibleFunction · 0.85
WithRefTrackingFunction · 0.85
serdeFunction · 0.85
commonMapFunction · 0.85

Tested by

no test coverage detected