From: Francois Berenger <francois.berenger@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] testing private functions with oUnit
Date: Mon, 29 Sep 2014 10:03:42 +0200 [thread overview]
Message-ID: <5429125E.7020201@inria.fr> (raw)
In-Reply-To: <87zjdioqe2.fsf@gmail.com>
On 09/29/2014 09:08 AM, Malcolm Matalka wrote:
> Out of curiosity: why? Any private function should be exercised through
> an API function somehow.
>
> IME, testing private functions often makes refactoring more painful
> without a clear win in code being better tested.
>
> If your API is pure, btw, you should checkout QCheck for testing it
> instead of unit tests.
You can also use qtest (available in opam) and write your test code
directly as comments in the .ml files, as is done in batteries:
https://github.com/ocaml-batteries-team/batteries-included/blob/master/src/batList.mlv
Look for (*$T in the code for example.
> My 2 cents,
> /M
>
> Eric Cooper <ecc@cmu.edu> writes:
>
>> I'd like to write unit tests for functions not exported in a .mli
>> file. The only way I can see is to remove the .mli file while
>> building the test, so the whole .ml file is visible. Is there a better
>> way, preferably integrated with ocamlmake + findlib?
>>
>> --
>> Eric Cooper e c c @ c m u . e d u
>
--
Regards,
Francois.
next prev parent reply other threads:[~2014-09-29 8:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-28 23:06 Eric Cooper
2014-09-28 23:12 ` Eric Cooper
2014-09-28 23:19 ` Ivan Gotovchits
2014-09-29 7:08 ` Malcolm Matalka
2014-09-29 8:03 ` Francois Berenger [this message]
2014-09-29 13:23 ` Eric Cooper
2014-09-29 8:28 ` ygrek
2014-09-29 8:50 ` Jeremie Dimino
2014-09-29 10:48 ` Gerd Stolpmann
2014-09-29 10:57 ` Gerd Stolpmann
2014-09-29 10:58 ` Maxence Guesdon
2014-09-29 12:00 ` Malcolm Matalka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5429125E.7020201@inria.fr \
--to=francois.berenger@inria.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox