reference: TestMatch(): use sub-tests

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-04-30 15:03:30 +02:00
parent 2819bca991
commit f238f7dcaa
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -608,17 +608,21 @@ func TestMatch(t *testing.T) {
},
}
for _, tc := range tests {
named, err := ParseAnyReference(tc.reference)
if err != nil {
t.Fatal(err)
}
actual, err := FamiliarMatch(tc.pattern, named)
if err != nil {
t.Fatal(err)
}
if actual != tc.expected {
t.Fatalf("expected %s match %s to be %v, was %v", tc.reference, tc.pattern, tc.expected, actual)
}
tc := tc
t.Run(tc.reference, func(t *testing.T) {
t.Parallel()
named, err := ParseAnyReference(tc.reference)
if err != nil {
t.Fatal(err)
}
actual, err := FamiliarMatch(tc.pattern, named)
if err != nil {
t.Fatal(err)
}
if actual != tc.expected {
t.Fatalf("expected %s match %s to be %v, was %v", tc.reference, tc.pattern, tc.expected, actual)
}
})
}
}