From b734f5e2e55832a19eb985352eb88d7ae2abee74 Mon Sep 17 00:00:00 2001 From: n3wbie Date: Mon, 24 Apr 2023 18:39:54 +0900 Subject: [PATCH] feat: handle bigint in ufmt.Sprintf --- examples/gno.land/p/demo/ufmt/ufmt.gno | 2 ++ examples/gno.land/p/demo/ufmt/ufmt_test.gno | 1 + 2 files changed, 3 insertions(+) diff --git a/examples/gno.land/p/demo/ufmt/ufmt.gno b/examples/gno.land/p/demo/ufmt/ufmt.gno index d116baab07c..0827c57ff44 100644 --- a/examples/gno.land/p/demo/ufmt/ufmt.gno +++ b/examples/gno.land/p/demo/ufmt/ufmt.gno @@ -52,6 +52,8 @@ func Sprintf(format string, args ...interface{}) string { buf += strconv.FormatUint(uint64(v), 10) case uint64: buf += strconv.FormatUint(v, 10) + case bigint: + buf += string(v) default: buf += "(unhandled)" } diff --git a/examples/gno.land/p/demo/ufmt/ufmt_test.gno b/examples/gno.land/p/demo/ufmt/ufmt_test.gno index 07ba76c55b0..146cfec9b7d 100644 --- a/examples/gno.land/p/demo/ufmt/ufmt_test.gno +++ b/examples/gno.land/p/demo/ufmt/ufmt_test.gno @@ -24,6 +24,7 @@ func TestSprintf(t *testing.T) { {"uint [%d]", []interface{}{uint(42)}, "uint [42]"}, {"int64 [%d]", []interface{}{int64(42)}, "int64 [42]"}, {"uint64 [%d]", []interface{}{uint64(42)}, "uint64 [42]"}, + {"bigint [%d]", []interface{}{bigint(42)}, "bigint [42]"}, {"bool [%t]", []interface{}{true}, "bool [true]"}, {"bool [%t]", []interface{}{false}, "bool [false]"}, {"invalid bool [%t]", []interface{}{"invalid"}, "invalid bool [(unhandled)]"},