From 58714f78a8897dc24a92e1924f7fb285a120baca Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Wed, 1 Apr 2020 17:19:48 +0200 Subject: [PATCH] accounts/abi: run pack tests as subtests --- accounts/abi/pack_test.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/accounts/abi/pack_test.go b/accounts/abi/pack_test.go index 69f739a122..f5440d6df3 100644 --- a/accounts/abi/pack_test.go +++ b/accounts/abi/pack_test.go @@ -613,18 +613,20 @@ func TestPack(t *testing.T) { "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), // tuple[1].A[1] }, } { - typ, err := NewType(test.typ, "", test.components) - if err != nil { - t.Fatalf("%v failed. Unexpected parse error: %v", i, err) - } - output, err := typ.pack(reflect.ValueOf(test.input)) - if err != nil { - t.Fatalf("%v failed. Unexpected pack error: %v", i, err) - } + t.Run(test.typ, func(t *testing.T) { + typ, err := NewType(test.typ, "", test.components) + if err != nil { + t.Fatalf("%v failed. Unexpected parse error: %v", i, err) + } + output, err := typ.pack(reflect.ValueOf(test.input)) + if err != nil { + t.Fatalf("%v failed. Unexpected pack error: %v", i, err) + } - if !bytes.Equal(output, test.output) { - t.Errorf("input %d for typ: %v failed. Expected bytes: '%x' Got: '%x'", i, typ.String(), test.output, output) - } + if !bytes.Equal(output, test.output) { + t.Errorf("input %d for typ: %v failed. Expected bytes: '%x' Got: '%x'", i, typ.String(), test.output, output) + } + }) } }