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 WAA05591; Mon, 20 Sep 2004 22:39:13 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA08529 for ; Mon, 20 Sep 2004 22:39:11 +0200 (MET DST) Received: from mail1.speakeasy.net (mail1.speakeasy.net [216.254.0.201]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i8KKd9nH001744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 20 Sep 2004 22:39:11 +0200 Received: (qmail 22008 invoked from network); 20 Sep 2004 20:39:08 -0000 Received: from dsl081-145-152.chi1.dsl.speakeasy.net (HELO firebird) ([64.81.145.152]) (envelope-sender ) by mail1.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 20 Sep 2004 20:39:08 -0000 Date: Mon, 20 Sep 2004 15:59:28 -0500 From: art yerkes To: caml-list@inria.fr Subject: Re: [Caml-list] Exceptions Handling and Unit Testing. Message-Id: <20040920155928.50409af6.ayerkes@speakeasy.net> In-Reply-To: <414F3BC6.2010705@ntlworld.com> References: <414F3BC6.2010705@ntlworld.com> X-Mailer: Sylpheed version 0.9.10 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 414F3FED.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; yerkes:01 ayerkes:01 caml-list:01 2004:99 ntlworld:99 foo:01 foo:01 chris:01 chris:01 speakeasy:01 int:01 int:01 sep:01 assert:02 exception:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, 20 Sep 2004 21:21:26 +0100 "chris.danx" wrote: > let some_construction_test some_op input exception error_msg = > try > let x = some_op input > in > OUnit.assert_failure error_msg > with > exception -> () with is an ordinary pattern: exception Foo of int ;; exception Bar ;; let f x = if x < 1 then raise (Foo 7) else if x > 100 then raise Bar else x - 1 ;; let g x = try f x with Foo n -> n ;; # g 3 ;; - : int = 2 # g (-1) ;; - : int = 7 # g 101 ;; Exception: Bar. -- Hey, Adam Smith, keep your invisible hands to yourself! ------------------- 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