My apologies if this is a naive question, but I was unable to find any similar topics here or on StackOverFlow. I am aware that testing public functions are generally recommended, and the test function’s naming convention is TestFoo() where Foo() is the public function.
However, say if I want to test a private function called doStuff(), then which will be the idiomatic way to name the test function for it.
Finally, the convention in Go is to use MixedCaps or mixedCaps rather than underscores to write multiword names.
I would say that from your example the best name will be TestdoStuff, since it’s not exported function. Same you can go with TestDoStuff. But no underscores in names
Yes, it seems MixedCaps/PascalCaps would be the most apt approach since with TestdoStuff, the linter goes crazy. I am going with TestDoStuff() and mention the private method testing in comments for better readability.