Home > Mobile >  Advanced module unit test setup in Julia
Advanced module unit test setup in Julia

Time:02-02

I have custom Julia package, which has hopefully quite standard structure. I have single package, src directory with sources and then test directory with all the tests. In my package I have 4 modules (1 "main" and entrypoint module) and then 3 submodules.

I am slowly adding tests to tests directory. Tests are importing modules with using keyword. Now problem is, very often I am testing some "private" or unnecessary method to be visible to outside and I have to export those functions even though I would not export them otherwise.

How to solve this? I was thinking that each module could have "Private" submodule containing all these "private" functions and constants used for unit testing so that I don't bloat exports of my clean module API.

CodePudding user response:

copied from comments as that seems to be the solution OP is looking for


you can always test functions that are not exported by calling them with MyModule.MySubModule.func()

  • Related