Skip to content

Commit

Permalink
feat: handle bigint in ufmt.Sprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
r3v4s committed Apr 24, 2023
1 parent 133ccaf commit b734f5e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/gno.land/p/demo/ufmt/ufmt.gno
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
}
Expand Down
1 change: 1 addition & 0 deletions examples/gno.land/p/demo/ufmt/ufmt_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -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)]"},
Expand Down

0 comments on commit b734f5e

Please sign in to comment.