github.com/lmittmann/w3@v0.20.0/internal/module/util_test.go (about) 1 package module 2 3 import ( 4 "math/big" 5 "strconv" 6 "testing" 7 ) 8 9 func TestBlockNumberArg(t *testing.T) { 10 tests := []struct { 11 Number *big.Int 12 Want string 13 }{ 14 {nil, "latest"}, 15 {big.NewInt(1), "0x1"}, 16 } 17 18 for i, test := range tests { 19 t.Run(strconv.Itoa(i), func(t *testing.T) { 20 got := BlockNumberArg(test.Number) 21 if test.Want != got { 22 t.Errorf("want %q, got %q", test.Want, got) 23 } 24 }) 25 } 26 }