Skip to content

Commit

Permalink
adding test
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed Dec 4, 2020
1 parent 217d1a5 commit 44cbb08
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions codec/codec_common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ type interfaceMarshaler struct {
}

func testInterfaceMarshaling(require *require.Assertions, cdc interfaceMarshaler, isAminoBin bool) {
_, err := cdc.marshal(nil)
require.Error(err, "can't marshal a nil value")

dog := &testdata.Dog{Name: "rufus"}
var dogI testdata.Animal = dog
bz, err := cdc.marshal(dogI)
Expand Down
2 changes: 2 additions & 0 deletions codec/proto_codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ func TestProtoMarsharlInterface(t *testing.T) {
cdc := codec.NewProtoCodec(createTestInterfaceRegistry())
m := interfaceMarshaler{cdc.MarshalInterface, cdc.UnmarshalInterface}
testInterfaceMarshaling(require.New(t), m, false)
m = interfaceMarshaler{cdc.MarshalInterfaceJSON, cdc.UnmarshalInterfaceJSON}
testInterfaceMarshaling(require.New(t), m, false)
}

func TestProtoCodec(t *testing.T) {
Expand Down

0 comments on commit 44cbb08

Please sign in to comment.