How to access private definition from other library for testing

  Kiến thức lập trình

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.

1

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website Kho Theme wordpress Kho Theme WP Theme WP

LEAVE A COMMENT