From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id BAA30001; Wed, 22 Sep 2004 01:23:25 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA32734 for ; Wed, 22 Sep 2004 01:23:23 +0200 (MET DST) Received: from mta04-svc.ntlworld.com (mta04-svc.ntlworld.com [62.253.162.44]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i8LNNBED029368 for ; Wed, 22 Sep 2004 01:23:23 +0200 Received: from [80.4.70.84] by mta04-svc.ntlworld.com (InterMail vM.4.01.03.37 201-229-121-137-20020806) with ESMTP id <20040921232134.PJAG4745.mta04-svc.ntlworld.com@[80.4.70.84]>; Wed, 22 Sep 2004 00:21:34 +0100 Message-ID: <4150B7DF.80701@ntlworld.com> Date: Wed, 22 Sep 2004 00:23:11 +0100 From: "chris.danx" User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "chris.danx" CC: Caml Mailing List Subject: Re: [Caml-list] Exceptions Handling and Unit Testing. References: <414F3BC6.2010705@ntlworld.com> In-Reply-To: <414F3BC6.2010705@ntlworld.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 4150B7DF.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; ntlworld:99 caml-list:01 closures:01 stupid:01 chris:01 chris:01 trivial:01 exception:02 exception:02 unit:03 data:03 data:03 exceptions:04 parameters:05 lists:91 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Oops! I keep clicking reply instead of reply all! :( Thanks for all the suggestions. It looks like I was generalising the wrong thing (concentrating on handling the exception, rather than the identification of a test repeated for different inputs). Instead I created a function which does the test and catches a specific exception but with the test data supplied as parameters. This enables constructing tests as closures from sample cases (each case has a test name, sample data and a message should the test fail), with the extension to lists of sample cases being a trivial application of List.map. Cases are added by putting them in a list. Simple really. *slaps himself for being stupid* Chris ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners