From 996d9dc4d300d7bba05165cde13067db39801f16 Mon Sep 17 00:00:00 2001 From: Victoria Erokhina Date: Thu, 3 Oct 2024 21:00:45 +0000 Subject: [PATCH] Add test for Unknown InMsgBody sumtype --- abi/messages_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/abi/messages_test.go b/abi/messages_test.go index 6bfdcc3..70aae7d 100644 --- a/abi/messages_test.go +++ b/abi/messages_test.go @@ -1,6 +1,7 @@ package abi import ( + "fmt" "github.com/tonkeeper/tongo/boc" "github.com/tonkeeper/tongo/tlb" "github.com/tonkeeper/tongo/ton" @@ -39,3 +40,24 @@ func TestEncodeAndDecodeInMsgBody(t *testing.T) { t.Fatalf("got different result") } } + +func TestDecodeAndEncodeUnknownInMsgBody(t *testing.T) { + data := "b5ee9c720101010100350000650000022800000000000000005012a05f200800c46663fd6592a0ca9ff0f04ed928fe74019bac1756d06092c14464fb3ce8d373" + boc1, _ := boc.DeserializeBocHex(data) + + var x InMsgBody + if err := tlb.Unmarshal(boc1[0], &x); err != nil { + t.Fatalf("Unable to unmarshal: %v", err) + } + + boc2 := boc.NewCell() + if err := tlb.Marshal(boc2, x); err != nil { + t.Fatalf("Unable to marshal: %v", err) + } + + b, _ := boc2.ToBoc() + res := fmt.Sprintf("%x", b) + if res != data { + t.Fatalf("got different result") + } +}