Bug#602298: [libounit-ocaml-dev] force "unit" return type in OUnit.bracket for typesafety
Package: libounit-ocaml-dev
Version: 1.0.3-5.0.2
Severity: wishlist
Tags: patch
--- Please enter the report below this line. ---
It would be useful to make return value of the testfunction f and teardown in
OUnit.bracket "unit" to enforce typing to avoid accidentally returning a
monadic type causing partial execution of a testcase. (e.g. when using Lwt)
See attached patch for a proposed solution.
Thanks, Joost Damad
--- System information. ---
Architecture: amd64
Kernel: Linux 2.6.32-5-amd64
Debian Release: squeeze/sid
500 unstable www.debian-multimedia.org
500 unstable ftp.nl.debian.org
500 testing dl.google.com
--- Package information. ---
Depends (Version) | Installed
===============================-+-===========
ocaml-nox-3.11.2 |
Package's Recommends field is empty.
Package's Suggests field is empty.
--
Joost Yervante Damad - http://damad.be/joost/
--- oUnit.ml 2008-06-07 05:45:24.000000000 +0200
+++ oUnit.ml.new 2010-11-03 15:05:15.000000000 +0100
@@ -9,11 +9,11 @@
let bracket set_up f tear_down () =
let fixture = set_up () in
try
- f fixture;
- tear_down fixture
+ let () = f fixture in
+ let () = tear_down fixture in
with
e ->
- tear_down fixture;
+ let () = tear_down fixture in
raise e
exception Skip of string
Reply to: