1. Sebastien Mondet
  2. pvem_lwt_unix

Commits

Sebastien Mondet  committed 9bf0a24

io_test: get rid of Core and Sexplib/Camlp4

  • Participants
  • Parent commits ac48274
  • Branches master

Comments (0)

Files changed (1)

File test/io_test.ml

View file
 #! /bin/sh
 
-PACKAGES=pvem,core,sexplib.syntax,lwt.unix,lwt.preemptive
+PACKAGES=pvem,lwt.unix,lwt.preemptive
 
 MD5=`md5sum $0  | cut -d ' ' -f 1`
 BASE=/tmp/ocaml_script_$MD5/
   tail -n +$SKIP $0 >> $ML_FILE
 
   ocamlfind ocamlopt  -I _build/ pvem_lwt_unix.cmxa -thread -package $PACKAGES \
-   -syntax camlp4o -linkpkg -o $EXEC $ML_FILE \
+   -linkpkg -o $EXEC $ML_FILE \
     && $EXEC $*
   RETURN_CODE=$?
 fi
 (*  PERFORMANCE OF THIS SOFTWARE.                                         *)
 (**************************************************************************)
 
-open Core.Std
 open Pvem_lwt_unix
 open Deferred_result
+open Printf
 
 let say fmt =
   ksprintf (fun s -> eprintf "%s\n%!" s) fmt
 
 
 let fail_test fmt =
-  ksprintf (fun s -> fail (`test_failed s)) fmt
+  ksprintf (fun s -> fail (`Test_failed s)) fmt
 
 let fail_test_if cond fmt =
   ksprintf (fun s ->
-    if cond then fail (`test_failed s) else return ()) fmt
+    if cond then fail (`Test_failed s) else return ()) fmt
 
 let test_with_out_channel () =
   let tmp = Filename.temp_file "io_test_with_out_channel" ".bin" in
   test_with_out_channel ()
 
 let () =
-  let module E = struct
-    type t = [
-      | `IO of [ `Exn of exn | `File_exists of string | `Read_file_exn of string * exn | `Write_file_exn of string * exn | `Wrong_path of string ]
-    | `io_test_exn of exn
-    | `test_failed of string
-    (* | `read_file_error of string * exn *)
-    (* | `write_file_error of string * exn *)
-    (* | `file_exists of string *)
-    (* | `wrong_path of string *)
-    | `system of
-        [ `file_info of string
-        | `list_directory of string
-        | `remove of string ] *
-          [ `exn of exn ]
-    | `transform of
-        [ `io_exn of exn
-        | `stopped_before_end_of_stream
-        | `transform_error of unit ]
-    ] with sexp_of
-  end in
   match Lwt_main.run (main ()) with
   | `Ok () -> ()
-  | `Error e ->
-    eprintf "End with Error:\n%s\n%!" (E.sexp_of_t e |! Sexp.to_string_hum);
+  | `Error (`IO _ as e) ->
+    eprintf "End with I/O error:\n%s\n%!" (IO.error_to_string e);
+    exit 1
+  | `Error (`Test_failed s) ->
+    eprintf "Test FAILED::\n%s\n%!" s;
     exit 1