github.com/line/ostracon@v1.0.10-0.20230328032236-7f20145f065d/libs/log/lazy_test.go (about) 1 package log 2 3 import ( 4 tmbytes "github.com/line/ostracon/libs/bytes" 5 "github.com/stretchr/testify/require" 6 "testing" 7 ) 8 9 func TestNewLazySprintf(t *testing.T) { 10 format := "echo:%s" 11 args := make([]interface{}, 0, 1) 12 args = append(args, "hello") 13 expected := LazySprintf{format: format, args: args} 14 actual := NewLazySprintf(format, args...) 15 require.Equal(t, expected.String(), actual.String()) 16 } 17 18 func TestNewLazyBlockHash(t *testing.T) { 19 block := testHashable{} 20 expected := LazyBlockHash{block: block} 21 actual := NewLazyBlockHash(block) 22 require.Equal(t, expected.String(), actual.String()) 23 } 24 25 type testHashable struct{} 26 27 func (testHashable) Hash() tmbytes.HexBytes { 28 return []byte{0} 29 }