mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-02 06:07:08 +00:00
libs/log: format []byte as hexidecimal string (uppercased) (#5960)
Closes: #5806 Co-authored-by: Lanie Hei <heixx011@umn.edu>
This commit is contained in:
co-authored by
Lanie Hei
parent
7e0436c6e6
commit
d76add65a6
@@ -3,6 +3,7 @@ package bytes
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -24,7 +25,6 @@ func TestMarshal(t *testing.T) {
|
||||
|
||||
// Test that the hex encoding works.
|
||||
func TestJSONMarshal(t *testing.T) {
|
||||
|
||||
type TestStruct struct {
|
||||
B1 []byte
|
||||
B2 HexBytes
|
||||
@@ -64,3 +64,10 @@ func TestJSONMarshal(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestHexBytes_String(t *testing.T) {
|
||||
hs := HexBytes([]byte("test me"))
|
||||
if _, err := strconv.ParseInt(hs.String(), 16, 64); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user