Browse thread
[Caml-list] Exceptions Handling and Unit Testing.
-
chris.danx
- chris.danx
- art yerkes
- Damien Doligez
- chris.danx
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | art yerkes <ayerkes@s...> |
| Subject: | Re: [Caml-list] Exceptions Handling and Unit Testing. |
On Mon, 20 Sep 2004 21:21:26 +0100 "chris.danx" <chris.danx@ntlworld.com> 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