0

There are some functions I'd like to expose on my contract but only for testing purposes. It seems reasonable to specify them with a visibility modifier of internal and have the test contract inherit from it. But I believe I read somewhere that this is an anti-pattern. I can't seem to find this reference again was wondering if someone could confirm/explain this for me? Thanks!

  • 2
    It's actually quite a good pattern. Just make sure you place that contract under helpers folder or something similar, in order to "declare" it a "non-operational" contract. The only problem with internal is that if you inherit from the contract for a "real" reason (i.e., not for testing purpose), then the inheriting contract may call internal functions or change internal variables which it is not supposed to. – goodvibration Apr 8 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.