Open DrDeano opened 5 years ago
You could also argue for only allowing public members to be visible inside tests, because if you test private members, you might end up testing implementation instead of testing behavior, and that's bad if you later want to refactor or switch to a new implementation.
The most important thing is consistency though, no matter which file the test resides in.
See: https://teamgaslight.com/blog/testing-behavior-vs-testing-implementation
I'd proposed this once in #608. Ability to test the internals is very useful, if one is into defensive coding.
When running under
zig test
.When separating out the unit tests from the main source file, have the private const/vars/function visible for the testing file that is testing the source file. For example:
src.zig:
test_src.zig: