caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Yawar Amin <yawar.amin@gmail.com>
To: Bahman Movaqar <bahman@bahmanm.com>
Cc: Ocaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] On variants, integers and testing
Date: Mon, 19 Mar 2018 09:27:38 -0400	[thread overview]
Message-ID: <CAJbYVJ+BBQC7Nu3PXrW8NiP_163O+MhNkx3dvF8bF=MWGDxD=w@mail.gmail.com> (raw)
In-Reply-To: <CACOw_MrR5M66=CB8Z=f7B+xiv5r8U87P3kE=p_8kyu8OCKCrjw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1694 bytes --]

Hi,

On Fri, Mar 16, 2018 at 7:12 AM, Bahman Movaqar <bahman@bahmanm.com> wrote:

> [...]
> Suppose that I wrote this piece of code as a library to be used by others
> as well. In such a case, practically the only function that the users are
> interested in is `solve`, as defined in the .mli file.
> This is good: keeps my library clean, the usage straight-forward and
> doesn't confuse the users.
>
> However, when it comes to testing, things are not that simple. Now that I
> have exported only 1 function in the .mli, I can only test that 1 function.
> Is this the proper way[2]?
>

This is a rather philosophical question. Some people like to test only the
exposed interface, because that's the only thing that's relevant to users.
The internal functionality should be there only to support the
external-facing interface, and thus testing the `solve` function
*thoroughly* should automatically test all internal functionality. If it
doesn't, then maybe that internal functionality shouldn't be there in the
first place?

But, maybe sometimes you do want to have some internal functionality and
you do want to test it. An OCaml can theoretically some of its files
(modules) from the outside world by telling its build system to not expose
the compiled interface (.cmi) files. This way, you can write and test these
internal modules and still hide them from users.

I haven't actually usec this technique, but certainly someone in this list
might have.

Regards,

Yawar

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

[-- Attachment #2: Type: text/html, Size: 2284 bytes --]

  parent reply	other threads:[~2018-03-19 13:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-16 11:12 Bahman Movaqar
2018-03-19 10:41 ` Cedric Cellier
2018-03-19 10:44   ` Cedric Cellier
2018-03-19 13:27 ` Yawar Amin [this message]
2018-03-19 13:49   ` Yawar Amin
2018-03-19 21:24 ` SP
2018-03-21 14:36   ` Lukasz Stafiniak

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='CAJbYVJ+BBQC7Nu3PXrW8NiP_163O+MhNkx3dvF8bF=MWGDxD=w@mail.gmail.com' \
    --to=yawar.amin@gmail.com \
    --cc=bahman@bahmanm.com \
    --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;
as well as URLs for NNTP newsgroup(s).