I have recently add some extensions to my app, an example of which can be found below.
Prior to this I was maintaining approx 93% code coverage, this has now dropped to around 56% and it appears all of the extensions I have added are showing 0% coverage.
Whilst I know a high code coverage % is not a gold seal, I do take some confidence in having a higher number.
Is it possible to mark these extensions as to be ignore when calculating %?
If not, is testing these as simple as invoking them within a test case and asserting the results?
I'd rather not test for the sake of testing, eg I don't want to test UIKit as I expect this has happened at Apple.
extension UIStackView {
func removeAllArrangedSubviews() {
let removedSubviews = arrangedSubviews.reduce([]) { (allSubviews, subview) -> [UIView] in
self.removeArrangedSubview(subview)
return allSubviews + [subview]
}
NSLayoutConstraint.deactivate(removedSubviews.flatMap({ $0.constraints }))
removedSubviews.forEach({ $0.removeFromSuperview() })
}
}