In short, no. but..
You can check the code that uses closure. The fact that closures are built into the source code and you don’t have any reflection mechanism does not allow you to test them for unity (however, you have many ways to check the material, not just unit tests), however, as a rule The code using closures is more compact, so while we are testing the whole block with closures, it’s good to use them. I tend to write a closure that is just a few lines of code, infact, you could actually create a function (called a closure) and unit test the function itself;).
int function(MyClass *){ // unit test here } //... void MyClass::method(){ // ... and unit test method auto f = [this] () { return function(this);}; applyFunctorOnCollection(f); }
source share