*: 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:
Jimmy Zelinskie
2017-12-29 17:44:45 -05:00
parent 5840cd3de1
commit 2004489016
8 changed files with 84 additions and 52 deletions

View File

@@ -43,11 +43,13 @@ func TestClientID(t *testing.T) {
}
for _, tt := range clientTable {
var clientID ClientID
copy(clientID[:], []byte(tt.clientID))
parsedID := NewClientID(PeerIDFromString(tt.peerID))
if parsedID != clientID {
t.Error("Incorrectly parsed peer ID", tt.peerID, "as", parsedID)
}
t.Run(tt.peerID, func(t *testing.T) {
var clientID ClientID
copy(clientID[:], []byte(tt.clientID))
parsedID := NewClientID(PeerIDFromString(tt.peerID))
if parsedID != clientID {
t.Error("Incorrectly parsed peer ID", tt.peerID, "as", parsedID)
}
})
}
}