make tests slightly easier to write

This commit is contained in:
Aneurin Barker Snook
2023-10-07 10:44:47 +01:00
parent fa4f403c46
commit 3c23ea8cde
2 changed files with 17 additions and 17 deletions
+7 -7
View File
@@ -15,18 +15,18 @@ func TestReadParams(t *testing.T) {
},
}
for _, testCase := range testCases {
t.Log("Input:", testCase.Input)
t.Log("Expected output:", testCase.Output)
for _, tc := range testCases {
t.Log("Input:", tc.Input)
t.Log("Expected output:", tc.Output)
params := ReadParams(testCase.Input)
params := ReadParams(tc.Input)
if len(params) != len(testCase.Output) {
t.Errorf("Expected %d parameters", len(testCase.Output))
if len(params) != len(tc.Output) {
t.Errorf("Expected %d parameters", len(tc.Output))
break
}
for i, name := range testCase.Output {
for i, name := range tc.Output {
if params[i] != name {
t.Errorf("Expected parameter %d to be %q", i, name)
}