How do you unit test private methods?

前端 未结 30 1445
无人及你
无人及你 2020-11-22 06:44

I\'m building a class library that will have some public & private methods. I want to be able to unit test the private methods (mostly while developing, but also it coul

30条回答
  •  伪装坚强ぢ
    2020-11-22 07:23

    CC -Dprivate=public
    

    "CC" is the command line compiler on the system I use. -Dfoo=bar does the equivalent of #define foo bar. So, this compilation option effectively changes all private stuff to public.

提交回复
热议问题