*: add subtests for all table driven tests
Because we use testify, this is less useful than normal, but this is still best practice for table-driven tests.
This commit is contained in:
parent
5840cd3de1
commit
2004489016
8 changed files with 84 additions and 52 deletions
frontend/http/bencode
|
@ -24,9 +24,11 @@ var unmarshalTests = []struct {
|
|||
|
||||
func TestUnmarshal(t *testing.T) {
|
||||
for _, tt := range unmarshalTests {
|
||||
got, err := Unmarshal([]byte(tt.input))
|
||||
require.Nil(t, err, "unmarshal should not fail")
|
||||
require.Equal(t, got, tt.expected, "unmarshalled values should match the expected results")
|
||||
t.Run(tt.input, func(t *testing.T) {
|
||||
got, err := Unmarshal([]byte(tt.input))
|
||||
require.Nil(t, err, "unmarshal should not fail")
|
||||
require.Equal(t, got, tt.expected, "unmarshalled values should match the expected results")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue