refactor: use proto.Message instead of ProtoMarshler (#14208)
This commit is contained in:
+10
-10
@@ -50,16 +50,16 @@ func testInterfaceMarshaling(require *require.Assertions, cdc interfaceMarshaler
|
||||
}
|
||||
|
||||
type mustMarshaler struct {
|
||||
marshal func(i codec.ProtoMarshaler) ([]byte, error)
|
||||
mustMarshal func(i codec.ProtoMarshaler) []byte
|
||||
unmarshal func(bz []byte, ptr codec.ProtoMarshaler) error
|
||||
mustUnmarshal func(bz []byte, ptr codec.ProtoMarshaler)
|
||||
marshal func(i proto.Message) ([]byte, error)
|
||||
mustMarshal func(i proto.Message) []byte
|
||||
unmarshal func(bz []byte, ptr proto.Message) error
|
||||
mustUnmarshal func(bz []byte, ptr proto.Message)
|
||||
}
|
||||
|
||||
type testCase struct {
|
||||
name string
|
||||
input codec.ProtoMarshaler
|
||||
recv codec.ProtoMarshaler
|
||||
input proto.Message
|
||||
recv proto.Message
|
||||
marshalErr bool
|
||||
unmarshalErr bool
|
||||
}
|
||||
@@ -121,10 +121,10 @@ func testMarshaling(t *testing.T, cdc codec.Codec) {
|
||||
m1 := mustMarshaler{cdc.Marshal, cdc.MustMarshal, cdc.Unmarshal, cdc.MustUnmarshal}
|
||||
m2 := mustMarshaler{cdc.MarshalLengthPrefixed, cdc.MustMarshalLengthPrefixed, cdc.UnmarshalLengthPrefixed, cdc.MustUnmarshalLengthPrefixed}
|
||||
m3 := mustMarshaler{
|
||||
func(i codec.ProtoMarshaler) ([]byte, error) { return cdc.MarshalJSON(i) },
|
||||
func(i codec.ProtoMarshaler) []byte { return cdc.MustMarshalJSON(i) },
|
||||
func(bz []byte, ptr codec.ProtoMarshaler) error { return cdc.UnmarshalJSON(bz, ptr) },
|
||||
func(bz []byte, ptr codec.ProtoMarshaler) { cdc.MustUnmarshalJSON(bz, ptr) },
|
||||
func(i proto.Message) ([]byte, error) { return cdc.MarshalJSON(i) },
|
||||
func(i proto.Message) []byte { return cdc.MustMarshalJSON(i) },
|
||||
func(bz []byte, ptr proto.Message) error { return cdc.UnmarshalJSON(bz, ptr) },
|
||||
func(bz []byte, ptr proto.Message) { cdc.MustUnmarshalJSON(bz, ptr) },
|
||||
}
|
||||
|
||||
t.Run(tc.name+"_BinaryBare",
|
||||
|
||||
Reference in New Issue
Block a user