简体   繁体   中英

Unit testing OCaml modules with pa_ounit

I have a simple module to test with a few inline pa_ounit tests, i've setup the directory in the oasis style and got it all to build.

For a reference I've been using: https://github.com/janestreet/textutils

How would one execute the unit-tests for the above repo? I'm assuming there's an executable .ml file to write but what goes in this, how it is it built and does it extend the tests described at the module level in any way?

I've read the docs for pa_ounit and they just make me more confused ha.

As pa_ounit readme says, run the executable that contains tests with inline-test-runner argument.

Even without pa_ounit (when using plain OUnit), the file with tests is compiled and then executed. You should probably try OUnit itself before you start using the syntax extension so you can get the feel of the system.

OASIS, a popular build automation tool, allows you to build tests and run them with "make test" easily. See https://ocaml.org/learn/tutorials/setting_up_with_oasis.html#Tests

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM