diff --git a/rpc/message/test/message.go b/rpc/message/test/message.go index df769d28..435f20af 100644 --- a/rpc/message/test/message.go +++ b/rpc/message/test/message.go @@ -17,6 +17,7 @@ type jsonMessage interface { type binaryMessage interface { StableMarshal([]byte) []byte + StableSize() int Unmarshal([]byte) error } @@ -53,6 +54,11 @@ func TestRPCMessage(t *testing.T, msgGens ...func(empty bool) message.Message) { } if bm, ok := msg.(binaryMessage); ok { + t.Run(fmt.Sprintf("%T.StableSize() does no allocations", bm), func(t *testing.T) { + require.Zero(t, testing.AllocsPerRun(1000, func() { + _ = bm.StableSize() + })) + }) t.Run(fmt.Sprintf("Binary_%T", msg), func(t *testing.T) { data := bm.StableMarshal(nil)