caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ANN: should.ml, literate assertions for OCaml
@ 2013-08-26 18:34 Mike Lin
  2013-08-27  8:21 ` Romain Bardou
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Lin @ 2013-08-26 18:34 UTC (permalink / raw)
  To: caml-list

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

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

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-27  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-26 18:34 [Caml-list] ANN: should.ml, literate assertions for OCaml Mike Lin
2013-08-27  8:21 ` Romain Bardou
2013-08-27  9:43   ` Oliver Bandel

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).