caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Marek Kubica <marek@xivilization.net>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Preferred layout for new packages
Date: Thu, 15 Nov 2012 08:24:43 +0100	[thread overview]
Message-ID: <20121115082443.2af5f758@xivilization.net> (raw)
In-Reply-To: <1352961419.10207.8.camel@Nokia-N900>

Hello Cedric,

On Thu, 15 Nov 2012 07:36:59 +0100
Cedric Cellier <rixed@happyleptic.org> wrote:

> > But having the test code in a comment
> > seems ugly to me. Maybe there could be some CamlP4 hack to exclude
> > it on normal compilation?
> 
> Since you mentioned python, a culture where
> unit tests are routinely written in
> comments, Im surprised by your opinion.
> Do you think all tests in comments are ugly or is there something
> specific to batteries tests that make these ugly?

Actually, In Python tests are not routinely written in comments. They
are usually written in Files called test_whatever.py as test_whatever
functions. Afterwards, people use test discovery tools like nose or
py.test that search for such modules and construct JUnit-style TestCase
classes out of these funtions and execute them.

The advantage is that writing a test only requires to write a single
function and does not need registration. Before there were test
discovery tools people wrote test methods in test classes and executed
that manually -- that is, they didn't write tests really, because it
was terribly tedious.

Your point about tests in comments is not entirely unbased: there are
doctests which are written in document comments and represent a
recorded console session that gets played back as test. Fancy concept,
but not many people use it.

In my opinion I dislike unit tests in comments, also because you throw
away editor support and it feels hackish, especially if the language
has a way of syntactic extension. Python doctests are on the verge of
unreadability, but given it is meant as a console session, it is still
kind of okay though not perfect.

Hope that answer helps you :)

regards,
Marek

  reply	other threads:[~2012-11-15  7:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14 11:43 Marek Kubica
2012-11-14 14:41 ` Török Edwin
2012-11-14 16:36   ` Marek Kubica
2012-11-15  1:20   ` Francois Berenger
2012-11-14 14:42 ` Edgar Friendly
2012-11-14 17:00   ` Marek Kubica
2012-11-14 18:00     ` forum
2012-11-15  9:00       ` Philippe Veber
2012-11-14 18:17     ` Martin Jambon
2012-11-14 18:48       ` Markus Mottl
2012-11-14 19:35         ` Martin Jambon
2012-11-15  6:36     ` Cedric Cellier
2012-11-15  7:24       ` Marek Kubica [this message]
2012-11-15  9:17         ` rixed
     [not found] <fa.38rAsBvHd+quECbtcbTH9HW+J6U@ifi.uio.no>
     [not found] ` <fa.YCrkHurCi6yY5s0Qg1r6uLWNQdY@ifi.uio.no>
     [not found]   ` <fa.oeqp0ymFFL+o76ut/LjBeQhUcjQ@ifi.uio.no>
     [not found]     ` <fa.pEDV80ILnW8x1YQyKuF3NBsK3Kw@ifi.uio.no>
     [not found]       ` <fa.LQofvqHUt8xj1kM1rvmQZF+Z7rw@ifi.uio.no>
2012-11-15  8:13         ` vincent.hugot
2012-11-15  8:31           ` Francois Berenger
2012-11-15  9:20           ` rixed
2012-11-15 17:22             ` Aleksey Nogin

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=20121115082443.2af5f758@xivilization.net \
    --to=marek@xivilization.net \
    --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).