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

Function TestRefResolverBoundaryRegression

go/fory/ref_resolver_test.go:207–220  ·  view source on GitHub ↗

TestRefResolverBoundaryRegression verifies that valid boundary indices (0 and len-1) still resolve correctly after the security fix.

(t *testing.T)

Source from the content-addressed store, hash-verified

205// TestRefResolverBoundaryRegression verifies that valid boundary indices
206// (0 and len-1) still resolve correctly after the security fix.
207func TestRefResolverBoundaryRegression(t *testing.T) {
208 resolver := newRefResolver(true)
209 val := reflect.ValueOf("test")
210
211 // Fill the resolver with 2 objects
212 id0, _ := resolver.PreserveRefId()
213 resolver.SetReadObject(id0, val)
214 id1, _ := resolver.PreserveRefId()
215 resolver.SetReadObject(id1, val)
216
217 // Verify boundary indices still work
218 require.Equal(t, val.String(), resolver.GetReadObject(0).String(), "Should resolve index 0")
219 require.Equal(t, val.String(), resolver.GetReadObject(1).String(), "Should resolve index len-1")
220}

Callers

nothing calls this directly

Calls 6

newRefResolverFunction · 0.85
PreserveRefIdMethod · 0.80
SetReadObjectMethod · 0.80
GetReadObjectMethod · 0.80
EqualMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected