vendredi 28 août 2015

Should functions used only by tests be part of the public API?

A prime example of this is equality operators. If only your tests need to compare your objects for equality, should the equality operator be defined alongside the tests or should it be part of the classes' public interface?

This is assuming there is a reasonable, single definition of equality for this class, and comparing instances for equality is something that might be useful outside of tests in the future.

What are the advantages and disadvantages of making it private to the tests versus making it public?

Aucun commentaire:

Enregistrer un commentaire