Quantcast
Channel: Active questions tagged ocaml - Stack Overflow
Viewing all articles
Browse latest Browse all 531

How to access private definition from other library for testing

$
0
0

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.


Viewing all articles
Browse latest Browse all 531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>