Merge PR #6076: Proto Any init + evidence

This commit is contained in:
Aaron Craelius
2020-05-05 10:28:20 -04:00
committed by GitHub
parent 7e72e5b8a6
commit 386217209d
82 changed files with 2145 additions and 1304 deletions
+14 -2
View File
@@ -7,8 +7,20 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/testdata"
"github.com/cosmos/cosmos-sdk/codec/types"
)
func createTestInterfaceRegistry() types.InterfaceRegistry {
interfaceRegistry := types.NewInterfaceRegistry()
interfaceRegistry.RegisterInterface("testdata.Animal",
(*testdata.Animal)(nil),
&testdata.Dog{},
&testdata.Cat{},
)
return interfaceRegistry
}
func TestProtoCodec(t *testing.T) {
testCases := []struct {
name string
@@ -20,7 +32,7 @@ func TestProtoCodec(t *testing.T) {
}{
{
"valid encoding and decoding",
codec.NewProtoCodec(),
codec.NewProtoCodec(createTestInterfaceRegistry()),
&testdata.Dog{Name: "rufus"},
&testdata.Dog{},
false,
@@ -28,7 +40,7 @@ func TestProtoCodec(t *testing.T) {
},
{
"invalid decode type",
codec.NewProtoCodec(),
codec.NewProtoCodec(createTestInterfaceRegistry()),
&testdata.Dog{Name: "rufus"},
&testdata.Cat{},
false,