阅读背景:

如何在go(golang)中测试未导出的(私有)函数?

来源:互联网 

I was interested in creating unit test for "unexported (private) functions" in go. However, its basically really hard to create unit tests form them in the test package because I have to make them "public". Which in the end, defeats the whole point of them being private. The point is that these helper function help modularize and now that they are modular, it would be nice to be able to create unit tests for them without making them available to everyone except the testing package, nice they are not functions that should be accessed or used by anyone else except the testing suite or the actual package itself.I was interested in creating unit test for "une




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: