diff --git a/node_test.go b/node_test.go index a84559f..5ba1aef 100644 --- a/node_test.go +++ b/node_test.go @@ -18,6 +18,10 @@ import ( mh "github.com/multiformats/go-multihash" ) +func init() { + RegisterCborType(BigIntAtlasEntry) +} + func assertCid(c cid.Cid, exp string) error { if c.String() != exp { return fmt.Errorf("expected cid of %s, got %s", exp, c) @@ -504,6 +508,27 @@ func TestStableCID(t *testing.T) { } } +func TestCidAndBigInt(t *testing.T) { + type Foo struct { + B *big.Int + A cid.Cid + } + RegisterCborType(Foo{}) + + nd, err := WrapObject("", mh.SHA2_256, -1) + if err != nil { + t.Fatal(err) + } + c := nd.Cid() + _, err = WrapObject(&Foo{ + A: c, + B: big.NewInt(1), + }, mh.SHA2_256, -1) + if err != nil { + t.Fatal(err) + } +} + func TestCanonicalStructEncoding(t *testing.T) { type Foo struct { Zebra string @@ -512,7 +537,6 @@ func TestCanonicalStructEncoding(t *testing.T) { Whale string Cat bool } - RegisterCborType(BigIntAtlasEntry) RegisterCborType(Foo{}) s := Foo{ diff --git a/package.json b/package.json index 9725321..681a5f5 100644 --- a/package.json +++ b/package.json @@ -39,9 +39,9 @@ }, { "author": "why", - "hash": "QmPAdjGx1huCjnrR26qy9QUUNSqA6EStyZ68RrwbtCTDML", + "hash": "QmfWqohMtbivn5NRJvtrLzCW3EU4QmoLvVNtmvo9vbdtVA", "name": "refmt", - "version": "1.1.1" + "version": "1.1.2" } ], "gxVersion": "0.10.0",