williamthome / doctest

A library to test Erlang documentation
https://hex.pm/packages/doctest
Apache License 2.0
7 stars 1 forks source link

Feature request: EUnit test generator API #45

Open eproxus opened 1 month ago

eproxus commented 1 month ago

I already have an EUnit setup that among other things modifies EUnit options, so replacing it with the doctests output from this library is not an option. However, it would be cool if the doctest module provided an EUnit generator function that could dump the test cases generated/discovered into an existing test suite, like so:

-module(my_tests).
-include_lib("eunit/include/eunit.hrl").

doc_test_() -> doctest:eunit_generator(my_module). % or some better name

That way, one can continue using ones existing test setup with minimal modifications.

williamthome commented 1 month ago

You can try doctest:module(my_module):

I'm using it in a CT test: https://github.com/williamthome/doctest/blob/7586739675c7d7ba7f1c2636685b2c6e86ae6f09/test/doctest_test.erl#L21

Is that what you desire?