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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id CE06F820A1 for ; Tue, 27 Aug 2013 10:21:24 +0200 (CEST) X-IronPort-AV: E=Sophos;i="4.89,966,1367964000"; d="scan'208";a="24866041" Received: from unknown (HELO [10.1.202.3]) ([194.254.61.161]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-CAMELLIA256-SHA; 27 Aug 2013 10:21:24 +0200 Message-ID: <521C6183.9010908@inria.fr> Date: Tue, 27 Aug 2013 10:21:23 +0200 From: Romain Bardou User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: caml-list@inria.fr References: In-Reply-To: X-Enigmail-Version: 1.4.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Validation-by: romain.bardou@inria.fr Subject: Re: [Caml-list] ANN: should.ml, literate assertions for OCaml 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 > | > > | > |