Avoid redundant decoded graph clones
This commit is contained in:
@@ -56,6 +56,15 @@ func TestCodecRoundTripsValidFixture(t *testing.T) {
|
||||
if !bytes.Equal(encoded, bytes.TrimSpace(fixture)) {
|
||||
t.Fatalf("fixture does not use canonical encoding\nwant: %s\n got: %s", fixture, encoded)
|
||||
}
|
||||
value.PlanAnnotations["test/chunker"][0] = '['
|
||||
value.Chunks[0].Annotations["test/chunker"][0] = '['
|
||||
decoded, err := codec.Decode(encoded)
|
||||
if err != nil {
|
||||
t.Fatalf("Decode(encoded) after mutation error = %v", err)
|
||||
}
|
||||
if string(decoded.PlanAnnotations["test/chunker"]) != `{"label":"fixture"}` || string(decoded.Chunks[0].Annotations["test/chunker"]) != `{"category":"sample"}` {
|
||||
t.Fatalf("Decode() reused mutable chunk-map storage: %#v", decoded)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildCanonicalizesAnnotationFormatting(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user