chore: add more test coverage

This commit is contained in:
Tristan Cartledge
2023-12-14 17:42:32 +00:00
parent a08b859904
commit 13b97f84db
5 changed files with 103 additions and 23 deletions

View File

@@ -247,6 +247,7 @@ func CheckMapForChanges[T any, R any](expLeft, expRight *orderedmap.Map[low.KeyR
return CheckMapForChangesWithComp(expLeft, expRight, changes, label, compareFunc, true)
}
// CheckMapForAdditionRemoval checks a left and right low level map for any additions or subtractions, but not modifications
func CheckMapForAdditionRemoval[T any](expLeft, expRight *orderedmap.Map[low.KeyReference[string], low.ValueReference[T]],
changes *[]*Change, label string,
) any {
@@ -254,20 +255,13 @@ func CheckMapForAdditionRemoval[T any](expLeft, expRight *orderedmap.Map[low.Key
doNothing := func(l, r T) any {
return nil
}
// Adding purely to make sure code is called for coverage.
var l, r T
doNothing(l, r)
// end of coverage code.
return CheckMapForChangesWithComp(expLeft, expRight, changes, label, doNothing, false)
}
//// CheckMapForAdditionRemoval checks a left and right low level map for any additions or subtractions, but not modifications
//func CheckMapForAdditionRemoval[T any, R any](expLeft, expRight map[low.KeyReference[string]]low.ValueReference[T],
// changes *[]*Change, label string) map[string]R {
//
// // do nothing
// doNothing := func(l, r T) R {
// return nil
// }
// return CheckMapForChangesWithComp(expLeft, expRight, changes, label, doNothing, false)
//}
// CheckMapForChangesWithComp checks a left and right low level map for any additions, subtractions or modifications to
// values. The compareFunc argument should reference the correct comparison function for the generic type. The compare
// bit determines if the comparison should be run or not.