use t.Run for tests

This commit is contained in:
Joel Wetzell
2026-02-27 22:30:52 -06:00
parent 0b20f3ffb9
commit eb8c6aba19
26 changed files with 208 additions and 273 deletions
@@ -1,7 +1,6 @@
package decoders
import (
"fmt"
"reflect"
"testing"
@@ -126,18 +125,16 @@ func TestGoodDataTrackerListChunkDecoding(t *testing.T) {
}
for _, testCase := range testCases {
t.Run(testCase.description, func(t *testing.T) {
actual, err := DecodeDataTrackerListChunk(testCase.bytes)
actual, err := DecodeDataTrackerListChunk(testCase.bytes)
if err != nil {
t.Errorf("failed to decode chunk properly, error: %v", err)
}
if err != nil {
t.Errorf("Test '%s' failed to decode chunk properly", testCase.description)
fmt.Println(err)
}
if !reflect.DeepEqual(actual, testCase.expected) {
t.Errorf("Test '%s' failed to decode chunk properly", testCase.description)
fmt.Printf("expected: %+v\n", testCase.expected)
fmt.Printf("actual: %+v\n", actual)
}
if !reflect.DeepEqual(actual, testCase.expected) {
t.Errorf("failed to decode chunk properly, expected: %+v, actual: %+v", testCase.expected, actual)
}
})
}
}