From: Romain Bardou <romain.bardou@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] ANN: should.ml, literate assertions for OCaml
Date: Tue, 27 Aug 2013 10:21:23 +0200 [thread overview]
Message-ID: <521C6183.9010908@inria.fr> (raw)
In-Reply-To: <CADxsieaPOzyw1vYAe7COt_gKREvqthgvd8y56tzWSwqDA30EpA@mail.gmail.com>
I'm not sure a language resembling plain English is a good idea (for
instance, does "above" mean ">" or ">="?) but I like the tricks you used
to avoid the need for a preprocessor :)
Cheers,
--
Romain Bardou
Le 26/08/2013 20:34, Mike Lin a écrit :
> Should.ml is a little library for writing assertion statements in a
> domain-specific language roughly resembling plain English. This makes
> lengthy series of assertions (such as in unit tests) a little nicer to
> read - example pasted below. Through some mild abuse of objects and
> operators, I avoided the need for any preprocessor or syntax extension.
>
> https://github.com/mlin/should.ml
> opam update && opam install should
>
> Happy testing!
> Mike
>
> Example:
>
>
> |open Should
>
> let int_test_case () =
> let x = 123 in begin
> x $hould # equal 123;
> x $hould # not # equal 0;
>
> x $hould # be # above 122;
> x $hould # be # at # most 124;
>
> x $hould # be # within (122,123);
> x $houldn't # be # within (1,3)
> end
> |
>
> |
> |
next prev parent reply other threads:[~2013-08-27 8:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-26 18:34 Mike Lin
2013-08-27 8:21 ` Romain Bardou [this message]
2013-08-27 9:43 ` Oliver Bandel
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=521C6183.9010908@inria.fr \
--to=romain.bardou@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