[ocaml-extlib] r416 committed - Add failing test for issue #26

0 views
Skip to first unread message

codesite...@google.com

unread,
Nov 11, 2013, 12:14:49 AM11/11/13
to ocaml-extl...@googlegroups.com
Revision: 416
Author: ygrekheretix
Date: Mon Nov 11 05:14:35 2013 UTC
Log: Add failing test for issue #26

http://code.google.com/p/ocaml-extlib/source/detail?r=416

Added:
/trunk/test/test_y_ExtHashtbl_001.ml

=======================================
--- /dev/null
+++ /trunk/test/test_y_ExtHashtbl_001.ml Mon Nov 11 05:14:35 2013 UTC
@@ -0,0 +1,34 @@
+(*
+ * ExtLib Testing Suite
+ * Copyright (C) 2013 ygrek
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version,
+ * with the special exception on linking described in file LICENSE.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ *)
+
+open ExtHashtbl
+
+(* Issue 26: Hashtbl.map is broken in OCaml >= 4.00 *)
+let test_map () =
+ let h = Hashtbl.create 1 in
+ Hashtbl.add h "test" 1;
+ let h1 = Hashtbl.map (fun x -> x + 1) h in
+ let find h k = try Some (Hashtbl.find h k) with Not_found -> None in
+ assert (find h "test" = Some 1);
+ assert (find h1 "test" = Some 2)
+
+let test () =
+ Util.run_test ~test_name:"y_ExtHashtbl.map" test_map;
+ ()
Reply all
Reply to author
Forward
0 new messages