I have two libraries:
lib/ dune src.ml src.mli test/ dune test.ml both are libraries and I am testing in the test library with ppx_inline_test as i do not want them to be included in the library
dune file in test looks like this:
(library (name Test_my_lib) (preprocess (pps ppx_inline_test ppx_expect)) (libraries base my_other_lib pp ppx_inline_test) (inline_tests) ) other one is identical without the inline tests
Obviously I can't access the functions from src.ml in the test library that way.
Is there a way I can test these functions from a different module without making them public? If not how can I easily test functions from another module without having the tests backed into the library (I am avoiding that mainly because I thought it's good practice)?
I've tried putting a separate .mli file including more definitions in the test module but that way it complains about not finding the source.
testproject you have can be useful to test the library only from its public interface. A lot of people say that you should only write unit tests using its public API (see Things I’ve learned from writing a lot of unit tests which quotes notably Kent Beck from the Agile Manifesto).