Hello, here my project directory content (an example created for the topic).
The dune file.
If I run the command “dune test” I got
File "test.ml", line 2, characters 5-11:
2 | open Program
Error: Unbound module Program
Edit: the output was badly copy pasted in the post, many readers were probably unable to understand, sorry.
Program module among
(modules test) and
(libraries ounit2). Also the executable cannot be listed under libraries.
There’s two ways to approach this:
Program into a dune library and make both the tests and the executable depend on that library.
- If you’ll only have these two modules, you can use the plural
(executables) stanza and put both
test into it. Then I think they can access each other. But you’ll need a separate
(rule) to actually run
“Program” is the main module, that sound wierd to make it a library.
I tried with a new file “main.ml”
(libraries ounit2 program))
Now it works but I added complexity to make dune working.