From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id B8733820A1 for ; Mon, 26 Aug 2013 20:34:46 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of mlin@mlin.net) identity=pra; client-ip=209.85.219.47; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mlin@mlin.net"; x-sender="mlin@mlin.net"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of mlin@mlin.net) identity=mailfrom; client-ip=209.85.219.47; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mlin@mlin.net"; x-sender="mlin@mlin.net"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-oa0-f47.google.com) identity=helo; client-ip=209.85.219.47; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mlin@mlin.net"; x-sender="postmaster@mail-oa0-f47.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkkCAEyeG1LRVdsvm2dsb2JhbABagkN5UYRFu1uBGggWDgEBAQEBBgsLCRQhB4NDB10SAQUBIhuHeZYegwCeLJB0hCQDiTGOPYEtjkwYKYRlggo X-IPAS-Result: AkkCAEyeG1LRVdsvm2dsb2JhbABagkN5UYRFu1uBGggWDgEBAQEBBgsLCRQhB4NDB10SAQUBIhuHeZYegwCeLJB0hCQDiTGOPYEtjkwYKYRlggo X-IronPort-AV: E=Sophos;i="4.89,961,1367964000"; d="scan'208";a="30440138" Received: from mail-oa0-f47.google.com ([209.85.219.47]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 26 Aug 2013 20:34:45 +0200 Received: by mail-oa0-f47.google.com with SMTP id g12so4034391oah.20 for ; Mon, 26 Aug 2013 11:34:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=VCqCaB2ujwprMXADUpSqGrwpY/sGWy0OkKSQkygoMgc=; b=DrSbqLeClQZNbthE9DytuqIzQ3NyisFjMe43/PBBkx9PeSGScitmGt484eCTrj/KuG RoV98ut68vECk+0Mh9+vcTvbWnK+PzlHX5EWtZT366hyGx1Ax9Mj9s7BEzQ4XQ3i3KXx kEjDuaNyFPPUQzIQWcllI05HaUZ08MyKEgrPKsuVAqbSDvMVEDGMsVHXX3/PSOdwUEFG Ci2YEcOFHWmT8kDm7imf6+U3aFPBp9ZYmf0gnm9T5gfWTJ6ru2JSenkZUpR1TeSqUzNz 2sRQZ4tBMG/Zku97KQWIXhFhzEHwUVHp0h2tUpRLBERQtrSC3kJ3GAnYbIVr7jc5AJ3Y 9vjg== X-Gm-Message-State: ALoCoQk5R25yRSjcJr9Q3SeCbHXPLvpFwfH/rw+t399O7InwRFu8A/+rszp/IbnKvtGshSMMbQ92 X-Received: by 10.60.134.14 with SMTP id pg14mr1576101oeb.66.1377542084675; Mon, 26 Aug 2013 11:34:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.162.97 with HTTP; Mon, 26 Aug 2013 11:34:24 -0700 (PDT) X-Originating-IP: [76.191.184.242] From: Mike Lin Date: Mon, 26 Aug 2013 11:34:24 -0700 Message-ID: To: "caml-list@inria.fr" Content-Type: multipart/alternative; boundary=047d7b4728689ed72004e4de02be X-Validation-by: mlin@mlin.net Subject: [Caml-list] ANN: should.ml, literate assertions for OCaml --047d7b4728689ed72004e4de02be Content-Type: text/plain; charset=ISO-8859-1 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 --047d7b4728689ed72004e4de02be Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Should.ml is a little library for writing assertion s= tatements in a domain-specific language roughly resembling plain English. T= his makes lengthy series of assertions (such as in unit tests) a little nic= er to read - example pasted below. Through some mild abuse of objects and o= perators, I avoided the need for any preprocessor or syntax extension.

opam update && opam inst= all should

Happy testing!
Mike

Example:

open Should

let int_test_case () =3D
    let x =3D 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
=
--047d7b4728689ed72004e4de02be--